1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
---|
2 | <HTML> |
---|
3 | <HEAD> |
---|
4 | <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> |
---|
5 | <TITLE>GTK+ FAQ: How to find, configure, install, and troubleshoot GTK+</TITLE> |
---|
6 | <LINK HREF="gtkfaq-3.html" REL=next> |
---|
7 | <LINK HREF="gtkfaq-1.html" REL=previous> |
---|
8 | <LINK HREF="gtkfaq.html#toc2" REL=contents> |
---|
9 | </HEAD> |
---|
10 | <BODY BGCOLOR="#FFFFFF"> |
---|
11 | <A HREF="gtkfaq-3.html">Next</A> |
---|
12 | <A HREF="gtkfaq-1.html">Previous</A> |
---|
13 | <A HREF="gtkfaq.html#toc2">Contents</A> |
---|
14 | <HR NOSHADE> |
---|
15 | <H2><A NAME="s2">2. How to find, configure, install, and troubleshoot GTK+</A></H2> |
---|
16 | |
---|
17 | <H2><A NAME="ss2.1">2.1 What do I need to run GTK+?</A> |
---|
18 | </H2> |
---|
19 | |
---|
20 | <P>To compile GTK+, all you need is a C compiler (gcc) and the X Window System |
---|
21 | and associated libraries on your system. |
---|
22 | <P> |
---|
23 | <H2><A NAME="ss2.2">2.2 Where can I get GTK+?</A> |
---|
24 | </H2> |
---|
25 | |
---|
26 | <P>The canonical site is: |
---|
27 | <PRE> |
---|
28 | ftp://ftp.gtk.org/pub/gtk |
---|
29 | </PRE> |
---|
30 | |
---|
31 | This site tends to get busy around the time of a new GTK+ release |
---|
32 | so try and use one of the mirror sites that are listed in |
---|
33 | <A HREF="ftp://ftp.gtk.org/etc/mirrors">ftp://ftp.gtk.org/etc/mirrors</A><P>Here's a few mirror sites to get you started: |
---|
34 | <UL> |
---|
35 | <LI>Africa - ftp://ftp.is.co.za/applications/gimp/</LI> |
---|
36 | <LI>Australia - ftp://ftp.au.gimp.org/pub/gimp/</LI> |
---|
37 | <LI>Finland - ftp://ftp.funet.fi/pub/sci/graphics/packages/gimp</LI> |
---|
38 | <LI>Germany - ftp://infosoc.uni-koeln.de/pub/ftp.gimp.org/</LI> |
---|
39 | <LI>Japan - ftp://SunSITE.sut.ac.jp/pub/archives/packages/gimp/</LI> |
---|
40 | <LI>UK - ftp://ftp.flirble.org/pub/X/gimp/</LI> |
---|
41 | <LI>US - ftp://ftp.insync.net/pub/mirrors/ftp.gimp.org/</LI> |
---|
42 | </UL> |
---|
43 | <P> |
---|
44 | <H2><A NAME="ss2.3">2.3 How do I configure/compile GTK+?</A> |
---|
45 | </H2> |
---|
46 | |
---|
47 | <P>Generally, all you will need to do is issue the commands: |
---|
48 | <PRE> |
---|
49 | ./configure |
---|
50 | make |
---|
51 | </PRE> |
---|
52 | |
---|
53 | in the gtk+-version/ directory. |
---|
54 | <P> |
---|
55 | <H2><A NAME="ss2.4">2.4 When compiling GTK+ I get an error like: <CODE>make: file `Makefile' line 456: Syntax error</CODE></A> |
---|
56 | </H2> |
---|
57 | |
---|
58 | <P>Make sure that you are using GNU make (use <CODE>make -v</CODE> to |
---|
59 | check). There are many weird and wonderful versions of make out there, |
---|
60 | and not all of them handle the automatically generated Makefiles. |
---|
61 | <P> |
---|
62 | <P> |
---|
63 | <H2><A NAME="ss2.5">2.5 I've compiled and installed GTK+, but I can't get any programs to link with it!</A> |
---|
64 | </H2> |
---|
65 | |
---|
66 | <P>This problem is most often encountered when the GTK+ libraries can't |
---|
67 | be found or are the wrong version. Generally, the compiler will |
---|
68 | complain about an 'unresolved symbol'. There are two things you need |
---|
69 | to check: |
---|
70 | <UL> |
---|
71 | <LI>Make sure that the libraries can be found. You want to edit |
---|
72 | /etc/ld.so.conf to include the directories which contain the GTK |
---|
73 | libraries, so it looks something like: |
---|
74 | <PRE> |
---|
75 | /usr/X11R6/lib |
---|
76 | /usr/local/lib |
---|
77 | </PRE> |
---|
78 | |
---|
79 | Then you need to run /sbin/ldconfig as root. You can find what directory |
---|
80 | GTK is in using |
---|
81 | <PRE> |
---|
82 | gtk-config --libs |
---|
83 | </PRE> |
---|
84 | |
---|
85 | |
---|
86 | If your system doesn't use ld.so to find libraries (such as Solaris), then |
---|
87 | you will have to use the LD_LIBRARY_PATH environment variable (or compile |
---|
88 | the path into your program, which I'm not going to cover here). So, with a |
---|
89 | Bourne type shell you can do (if your GTK libraries are in /usr/local/lib): |
---|
90 | <PRE> |
---|
91 | export LD_LIBRARY_PATH=/usr/local/lib |
---|
92 | </PRE> |
---|
93 | |
---|
94 | and in a csh, you can do: |
---|
95 | <PRE> |
---|
96 | setenv LD_LIBRARY_PATH /usr/local/lib |
---|
97 | </PRE> |
---|
98 | |
---|
99 | </LI> |
---|
100 | <LI>Make sure the linker is finding the correct set of libraries. If you |
---|
101 | have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this |
---|
102 | older version may be used. Now (assuming you have a RedHat |
---|
103 | system), issue the command |
---|
104 | <PRE> |
---|
105 | rpm -e gtk gtk-devel |
---|
106 | </PRE> |
---|
107 | |
---|
108 | You may also want to remove the packages that depend on gtk (rpm will |
---|
109 | tell you which ones they are). If you don't have a RedHat Linux |
---|
110 | system, check to make sure that neither |
---|
111 | <PRE> |
---|
112 | /usr/lib |
---|
113 | </PRE> |
---|
114 | or |
---|
115 | <PRE> |
---|
116 | /usr/local/lib |
---|
117 | </PRE> |
---|
118 | contain any of the libraries libgtk, |
---|
119 | libgdk, libglib, or libgck. If they do exist, remove them (and any |
---|
120 | gtk include files, such as /usr/include/gtk and /usr/include/gdk) and |
---|
121 | reinstall gtk+. </LI> |
---|
122 | </UL> |
---|
123 | <P> |
---|
124 | <H2><A NAME="ss2.6">2.6 When compiling programs with GTK+, I get compiler error messages about not being able to find <CODE>"glibconfig.h"</CODE>.</A> |
---|
125 | </H2> |
---|
126 | |
---|
127 | <P>The header file "glibconfig.h" was moved to the directory |
---|
128 | $exec_prefix/lib/glib/include/. $exec_prefix is the |
---|
129 | directory that was specified by giving the --exec-prefix |
---|
130 | flags to ./configure when compiling GTK+. It defaults to |
---|
131 | $prefix, (specified with --prefix), which in turn defaults |
---|
132 | to /usr/local/. |
---|
133 | <P>This was done because "glibconfig.h" includes architecture |
---|
134 | dependent information, and the rest of the include files |
---|
135 | are put in $prefix/include, which can be shared between different |
---|
136 | architectures. |
---|
137 | <P>GTK+ includes a shell script, <CODE>gtk-config</CODE>, that |
---|
138 | makes it easy to find out the correct include paths. |
---|
139 | The GTK+ tutorial includes an example of using <CODE>gtk-config</CODE> |
---|
140 | for simple compilation from the command line. For information |
---|
141 | about more complicated configuration, see the file |
---|
142 | docs/gtk-config.txt in the GTK+ distribution. |
---|
143 | <P>If you are trying to compile an old program, you may |
---|
144 | be able to work around the problem by configuring it |
---|
145 | with a command line like: |
---|
146 | <P> |
---|
147 | <BLOCKQUOTE><CODE> |
---|
148 | <PRE> |
---|
149 | CPPFLAGS="-I/usr/local/include/glib/include" ./configure |
---|
150 | </PRE> |
---|
151 | </CODE></BLOCKQUOTE> |
---|
152 | <P>for Bourne-compatible shells like bash, or for csh variants: |
---|
153 | <P> |
---|
154 | <BLOCKQUOTE><CODE> |
---|
155 | <PRE> |
---|
156 | setenv CPPFLAGS "-I/usr/local/include/glib/include" |
---|
157 | ./configure |
---|
158 | </PRE> |
---|
159 | </CODE></BLOCKQUOTE> |
---|
160 | <P>(Substitute the appropriate value of $exec_prefix for /usr/local.) |
---|
161 | <P> |
---|
162 | <H2><A NAME="ss2.7">2.7 When installing a GTK+ application, configure reports that it can't find GTK.</A> |
---|
163 | </H2> |
---|
164 | |
---|
165 | <P>There are several common reasons for this: |
---|
166 | <UL> |
---|
167 | <LI>You have an old version of GTK installed somewhere. RedHat 5.0, for |
---|
168 | example, installs an older copy of GTK that may not work with the latest |
---|
169 | applications. You should remove this old copy, but note that in the case |
---|
170 | of RedHat 5.0 this will break the <CODE>control-panel</CODE> applications. |
---|
171 | <P> |
---|
172 | </LI> |
---|
173 | <LI><CODE>gtk-config</CODE> (or another component of GTK) isn't in your path, or |
---|
174 | there is an old version on your system. Type: |
---|
175 | <PRE> |
---|
176 | gtk-config --version |
---|
177 | </PRE> |
---|
178 | |
---|
179 | to check for both of these. If it returns a value different from what |
---|
180 | you expect, then you have an old version of GTK on your system. |
---|
181 | <P> |
---|
182 | </LI> |
---|
183 | <LI>The ./configure script can't find the GTK libraries. As ./configure |
---|
184 | compiles various test programs, it needs to be able to find the GTK |
---|
185 | libraries. See the question above for help on this.</LI> |
---|
186 | </UL> |
---|
187 | <P>If none of the above help, then have a look in config.log, which is |
---|
188 | generated by ./configure as it runs. At the bottom will be the last |
---|
189 | action it took before failing. If it is a section of source code, copy |
---|
190 | the source code to a file and compile it with the line just above it in |
---|
191 | config.log. If the compilation is successful, try executing it. |
---|
192 | <P> |
---|
193 | <HR NOSHADE> |
---|
194 | <A HREF="gtkfaq-3.html">Next</A> |
---|
195 | <A HREF="gtkfaq-1.html">Previous</A> |
---|
196 | <A HREF="gtkfaq.html#toc2">Contents</A> |
---|
197 | </BODY> |
---|
198 | </HTML> |
---|