Posts

PKG_CONFIG_PATH is wonderful

I’m trying to install GTK+ version 2 (2.10.4) on my CentOS 4.4 (Red Hat compatible) system. Right after I run the ‘./configure’ command, I get a complaint about having the incorrect version of glib installed:

checking for BASE\_DEPENDENCIES... Requested 'glib-2.0 >= 2.12.0' but version of GLib is 2.4.7
configure: error: Package requirements (glib-2.0 >= 2.12.0 atk >= 1.9.0 pango >= 1.12.0 cairo >= 1.2.0) were not met.
Consider adjusting the PKG\_CONFIG\_PATH environment variable if you
installed software in a non-standard prefix.

So I download and install glib from source. It installs perfectly, no problemo. Then I go back to my gtk install dir and run ‘./configure’ again, but I get the _same exact complaint_.

This is really, _really_ annoying.

The thing to understand about this is that the newer glib I just installed was placed in ‘/usr/local/lib’, rather than ‘/usr/lib’. But ‘/usr/lib’ is checked first! So the old version is found rather than the new one I just installed.

Solution:

export PKG\_CONFIG\_PATH=/usr/local/lib/pkgconfig

This tells pkg-config where to look for the proper (newer) installed libraries. See here, this is the original:

> cat /usr/lib/pkgconfig/glib-2.0.pc
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include

glib\_genmarshal=glib-genmarshal
gobject\_query=gobject-query
glib\_mkenums=glib-mkenums

Name: GLib
Description: C Utility Library
Version: 2.4.7
Libs: -L${libdir} -lglib-2.0
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include

And this is the newer one I just installed:

> cat /usr/local/lib/pkgconfig/glib-2.0.pc
prefix=/usr/local
exec\_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

glib\_genmarshal=glib-genmarshal
gobject\_query=gobject-query
glib\_mkenums=glib-mkenums

Name: GLib
Description: C Utility Library
Version: 2.12.3
Libs: -L${libdir} -lglib-2.0
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include

[http://gtk.org/](http://gtk.org/)

Technical issues like this are what is keeping Linux off the mainstream desktop.

Leave a Reply

You must be logged in to post a comment.

Archives and Links