emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GTK build crashes under X


From: Jan Djärv
Subject: Re: GTK build crashes under X
Date: Thu, 07 Dec 2006 08:42:40 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061107)



Eli Zaretskii skrev:


Btw, this pkg-config thingy is a terrible nuisance.  I recently had to
build some package on a RH box, and was amazed to find that all the
``usual'' tricks of getting `configure' to use non-default include and
library paths simply don't work, because that package's `configure'
script used pkg-config to find all the headers and libraries, and as
you say above, what pkg-config returns cannot be overridden easily.
For example, "LDFLAGS=-L/whatever ./configure" cannot override the
places where the linker run by `configure' looks for libraries.  This
means, for example, that if you are an underprivileged user who
installs packages and libraries under ~/, you have no hope of getting
the compiler and the linker to use headers and libraries in those
private directories, since pkg-config doesn't know about them and
keeps pointing the build process to the public directories.

It can be a pain sometimes, but for the most part it works quite well.


(If there's a reasonable way of working around this, please let me
know.)


As Henrik Enberg pointed out:
"PKG_CONFIG_PATH=/path/to/dir/with/foo.pc ./configure"

PKG_CONFIG_PATH can be set like PATH, and pkg-config will search those directories for foo.pc. This file defines what foo needs to compile and link, like for example gtk+-2.0.pc:

Requires: gdk-${target}-2.0 atk cairo

${target} expands to x11 in my case.

Then pkg-config searches for gdk-x11-2.0.pc, atk.pc and pango.pc, using the same PKG_CONFIG_PATH.

Do we document the LDFLAGS-trick somewhere? We should add something about PKG_CONFIG_PATH there.

I hope Emacs will _never_ use pkg-config for anything serious, because
otherwise I will be at the mercy of the sysadmins on too many systems
I work on, where I cannot become a superuser and "make install" the
optional image libraries needed by Emacs.  (Also, most of the Emacs
INSTALL file will become incorrect if we ever start using pkg-config,
and even now the GTK build is already hit by this problem.)

Why in the world would GNU/Linux developers wish to use such a
restrictive tool?  Do they somehow miss the non-freedom of MS-Windows?

:-)  AFAIK pkg-config is available for MS-Windows.

The initial motivation (I think) was that the thing pkg-config does was too complicated for configure. For example, if lib A needs lib X and Y, and lib B also needs X, you would before pkg-config have two -l/path/to/X -lX in your link command line. And this would multiply. I've seen command lines with the same stuff repeated over and over again so eventually the line was too long to execute.

It also manages cascading dependencies, i.e. A depends on X but X itself depends on B and maybe C if X version is > 1.4. Then C depends on D and E.

This is too complicated for configure, so here pkg-config does a really nice 
job.

It is also very nice to be able to write in your Makefile:

PKG = libgnomeui-2.0
prog: $(OBJ)
        $(CXX) -o $@  $(OBJS) `pkg-config $(PKG) --libs`

and you get all required stuff linked in.

Also, you can easily query for required version, like Emacs does in 
configure.in:

pkg-config --exists "gtk+-2.0 >= 2.4 glib-2.0 > 2.4"

In summary, pkg-config is a very helpful tool, but you have to get use to it.

        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]