To compile GTK+, all you need is a C compiler (gcc) and the X Window System and associated libraries on your system.
The canonical site is:
ftp://ftp.gtk.org/pub/gtkThis site tends to get busy around the time of a new GTK+ release so try and use one of the mirror sites that are listed in ftp://ftp.gtk.org/etc/mirrors
Here's a few mirror sites to get you started:
Generally, all you will need to do is issue the commands:
./configure makein the gtk+-version/ directory.
make: file `Makefile' line 456: Syntax error
Make sure that you are using GNU make (use make -v
to
check). There are many weird and wonderful versions of make out there,
and not all of them handle the automatically generated Makefiles.
This problem is most often encountered when the GTK+ libraries can't be found or are the wrong version. Generally, the compiler will complain about an 'unresolved symbol'. There are two things you need to check:
/usr/X11R6/lib /usr/local/libThen you need to run /sbin/ldconfig as root. You can find what directory GTK is in using
gtk-config --libsIf your system doesn't use ld.so to find libraries (such as Solaris), then you will have to use the LD_LIBRARY_PATH environment variable (or compile the path into your program, which I'm not going to cover here). So, with a Bourne type shell you can do (if your GTK libraries are in /usr/local/lib):
export LD_LIBRARY_PATH=/usr/local/liband in a csh, you can do:
setenv LD_LIBRARY_PATH /usr/local/lib
rpm -e gtk gtk-develYou may also want to remove the packages that depend on gtk (rpm will tell you which ones they are). If you don't have a RedHat Linux system, check to make sure that neither
/usr/libor
/usr/local/libcontain any of the libraries libgtk, libgdk, libglib, or libgck. If they do exist, remove them (and any gtk include files, such as /usr/include/gtk and /usr/include/gdk) and reinstall gtk+.
"glibconfig.h"
.
The header file "glibconfig.h" was moved to the directory $exec_prefix/lib/glib/include/. $exec_prefix is the directory that was specified by giving the --exec-prefix flags to ./configure when compiling GTK+. It defaults to $prefix, (specified with --prefix), which in turn defaults to /usr/local/.
This was done because "glibconfig.h" includes architecture dependent information, and the rest of the include files are put in $prefix/include, which can be shared between different architectures.
GTK+ includes a shell script, gtk-config
, that
makes it easy to find out the correct include paths.
The GTK+ tutorial includes an example of using gtk-config
for simple compilation from the command line. For information
about more complicated configuration, see the file
docs/gtk-config.txt in the GTK+ distribution.
If you are trying to compile an old program, you may be able to work around the problem by configuring it with a command line like:
CPPFLAGS="-I/usr/local/include/glib/include" ./configure
for Bourne-compatible shells like bash, or for csh variants:
setenv CPPFLAGS "-I/usr/local/include/glib/include"
./configure
(Substitute the appropriate value of $exec_prefix for /usr/local.)
There are several common reasons for this:
control-panel
applications.
gtk-config
(or another component of GTK) isn't in your path, or
there is an old version on your system. Type:
gtk-config --versionto check for both of these. If it returns a value different from what you expect, then you have an old version of GTK on your system.
If none of the above help, then have a look in config.log, which is generated by ./configure as it runs. At the bottom will be the last action it took before failing. If it is a section of source code, copy the source code to a file and compile it with the line just above it in config.log. If the compilation is successful, try executing it.