source: trunk/third/gtk/docs/html/gtkfaq-2.html @ 14810

Revision 14810, 6.7 KB checked in by ghudson, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14809, which included commits to RCS files with non-trunk default branches.
Line 
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
21and 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>
28ftp://ftp.gtk.org/pub/gtk
29</PRE>
30
31This site tends to get busy around the time of a new GTK+ release
32so 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
50make
51</PRE>
52
53in 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
59check). There are many weird and wonderful versions of make out there,
60and 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
67be found or are the wrong version. Generally, the compiler will
68complain about an 'unresolved symbol'.  There are two things you need
69to 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
73libraries, so it looks something like:
74<PRE>
75/usr/X11R6/lib
76/usr/local/lib
77</PRE>
78
79Then you need to run /sbin/ldconfig as root. You can find what directory
80GTK is in using
81<PRE>
82gtk-config --libs
83</PRE>
84
85
86If your system doesn't use ld.so to find libraries (such as Solaris), then
87you will have to use the LD_LIBRARY_PATH environment variable (or compile
88the path into your program, which I'm not going to cover here). So, with a
89Bourne type shell you can do (if your GTK libraries are in /usr/local/lib):
90<PRE>
91export LD_LIBRARY_PATH=/usr/local/lib
92</PRE>
93
94and in a csh, you can do:
95<PRE>
96setenv 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
101have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this
102older version may be used. Now (assuming you have a RedHat
103system), issue the command
104<PRE>
105rpm -e gtk gtk-devel
106</PRE>
107
108You may also want to remove the packages that depend on gtk (rpm will
109tell you which ones they are). If you don't have a RedHat Linux
110system, 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,
119libgdk, libglib, or libgck.  If they do exist, remove them (and any
120gtk include files, such as /usr/include/gtk and /usr/include/gdk) and
121reinstall 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
129directory that was specified by giving the --exec-prefix
130flags to ./configure when compiling GTK+. It defaults to
131$prefix, (specified with --prefix), which in turn defaults
132to /usr/local/.
133<P>This was done because "glibconfig.h" includes architecture
134dependent information, and the rest of the include files
135are put in $prefix/include, which can be shared between different
136architectures.
137<P>GTK+ includes a shell script, <CODE>gtk-config</CODE>, that
138makes it easy to find out the correct include paths.
139The GTK+ tutorial includes an example of using <CODE>gtk-config</CODE>
140for simple compilation from the command line. For information
141about more complicated configuration, see the file
142docs/gtk-config.txt in the GTK+ distribution.
143<P>If you are trying to compile an old program, you may
144be able to work around the problem by configuring it
145with a command line like:
146<P>
147<BLOCKQUOTE><CODE>
148<PRE>
149CPPFLAGS="-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>
156setenv 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
168example, installs an older copy of GTK that may not work with the latest
169applications. You should remove this old copy, but note that in the case
170of 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
174there is an old version on your system. Type:
175<PRE>
176gtk-config --version
177</PRE>
178
179to check for both of these. If it returns a value different from what
180you 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
184compiles various test programs, it needs to be able to find the GTK
185libraries. 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
188generated by ./configure as it runs. At the bottom will be the last
189action it took before failing. If it is a section of source code, copy
190the source code to a file and compile it with the line just above it in
191config.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>
Note: See TracBrowser for help on using the repository browser.