How to install GTK from source code on Solaris 10

by Larry Liu (modified: 2007 Dec 27)

Background

I'm fixing bug#13770 for Eiffel Studio 6.1.71477, so I have to switch my Solaris 10's GTK version from default 2.4.1 to 2.4.9. It means the bug only happens on GTK 2.4.9 but not 2.4.1.

Gtk relies on Glib, Pango, Atk libraries. So if you want to compile Gtk library, you have to prepare all the libraries source codes.

In practice I only downloaded Gtk, Glib and Pango libraries. Atk library seems not needed in my case.

Download source codes

Please make sure the version values of Glib, Gtk and Pango can't be too much differences. Otherwise when making GTK, syntax error happens. For me, the exactly error is:

  • ../../gtk/gtkstatusbar.h:71: error: syntax error before "GMemChunk"

So it's a good idea to download all of the three libraries from the same page like:

ftp://ftp.gtk.org/pub/gtk/v2.4/

Before install

Rename/remove all library (Gtk, Glib, Pango) related files before ./configure'. Otherwise, it will NOT overwrite OLD glib files. The ./configure', make' and make install' will NOT report any error for this. So it looks everything goes fine, but actually you still using the old one if you haven't remove them first.

I use command

  • find /usr -name xxx

to find all related library folders, then rename the folder with a `~' prefix.

When compiling (make) GTK 2.4.9, maybe we have to revert the rename/remove of pango-1.0 folder in /usr/include. I'm not sure whether this step is correct. Sorry.

Start install

Like install all other softwares from source codes on Unix, the procedure is

  • cd $your_gtk_source_codes
  • ./configure
  • make
  • make install

But on Solaris, we have to define PKG_CONFIG_PATH before the run ./configure'. Otherwise, it will not update *.pc file. The bad result is when you query library version from pkg-config --modversion xxx', it will tell you the old value.

For example, on my machine when installing Glib 2.4.1, I first

  • export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Then run the ./configure', make' and `make install'. After installation, I run

  • pkg-config --modversion glib-2.0

It will return 2.4.1 which is expected.

Comments
  • Manu (9 years ago 27/12/2007)

    You do not have to override your existing version of GTK for that. You can set the `prefix' and compile/install it in your home directory. Then it is just a matter of switching the value of LD_LIBRARY_PATH and PKG_CONFIG_PATH to point to the right version.