ch0wned Part 2 – GTK+ and GLIB in your own home directory

Written by max on 2009-03-04

ch0wned. adj. This is the state when you are a linux user and don't have root access.

For today’s installment we go over getting some basic libraries up to shape. If your Linux distro is old enough, you can’t use 3rd party binaries like Adobe Acrobat Reader (acroread), Firefox, and Flash because the GTI+ and GLIB libraries that they are compiled against are just too damned old. So we have to both install local copies, and have the applications find those copies instead of the system ones.

On Versions

It’s good to note that you can upgrade a newer version of most things, but don’t expect to always get the newest version. Instead you need to find the next newest version that still works on your old Linux distro while satisfying the prerequisites for your favorite applications.

GTK+ and GLIB and RHEL4

Here are the packages I installed in order to get GTK+ and GLIB up to date enough to use Firefox, Pidgin, Thunderbird, Acrobat, and some other goodies on Red Hat EL4 (Fedora 4 should be similar) :

  1. atk-1.25.2.tar.bz2 – Needed by Pidgin
  2. pixman-0.13.2.tar.gz
  3. libxml2-2.6.30.tar.bz2 – Needed by Pidgin, the EL4 version is horribly broken and Gtalk / Jabber end up w/ a very weird send-only behavior
  4. pkg-config-0.23.tar.gz – Needed by most everything. You will have a new package repository in $HOME/lib/pkg-config for your new libraries.
  5. cairo-1.8.6.tar.gz
  6. dbus-1.2.12.tar.gz
  7. dbus-glib-0.78.tar.gz
  8. glib-2.19.5.tar.bz2
  9. pango-1.22.4.tar.bz2
  10. zlib-1.2.3.tar.bz2 – RHEL4 version is crap.
  11. gtk+-2.14.7.tar.bz2

Order does count, but I don’t remember what order I compiled and installed these in. Trial and error will tell. Use config_gapp from Part 1 to compile.

You will need to do this on each of the above :

$ tar xvfj gtk+-2.14.7.tar.bz2
$ cd gtk+-2.14.7
$ ../config_gapp
$ make
$ make install

Remember this is installing these libraries into $HOME/lib using the config_gapp script.

Some of the libraries might take some extra args to make things happy.

  1. zlib – I need to add -fPIC to make mozilla happy
    $ CFLAGS=-fPIC ../config_gapp
  2. gtk+-2.14.7 – I had to add –without-libjasper
    $ ../config_gapp --without-libjasper

Some blood sweat and tears later, and now you should be able to run a binary version of Firefox if you are on a 32-bit RHEL4 machine.

Running Apps using the Libraries in your Home Directory

In order to have applications grab the libraries in your home directory instead of the system ones, I use a wrapper script that sets up a bunch of needed environment variables. I call this script “run_gapp” :

#!/bin/sh
#
# install apps using local versions of libraries for this platform
#
# This script is for an x86_64 machine
# Remove 64 anywhere below if you are on a 32-bit build
 
LOC_HOME=/home/me
 
export CPPFLAGS="-I${LOC_HOME}/include -I/usr/X11R6/include $CPPFLAGS"
export CFLAGS="-I${LOC_HOME}/include -I/usr/X11R6/include $CFLAGS"
export CXXFLAGS="-I${LOC_HOME}/include -I/usr/X11R6/include $CXXFLAGS"
export LDFLAGS="-L${LOC_HOME}/lib -L/usr/X11R6/lib -L/usr/lib64 $LDFLAGS"
export PKG_CONFIG_PATH="${LOC_HOME}/lib/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="${LOC_HOME}/lib:/usr/X11R6/lib64:/usr/lib64:$LD_LIBRARY_PATH"
 
exec "$@"

Now to run a binary we just use the wrapper

run_gapp /path/to/firefox

Next up we’ll explore building some applications like pidign, firefox, amarok, xine-lib and more.