[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pkg-config and versioning of static libraries
From: |
Pavel Roskin |
Subject: |
pkg-config and versioning of static libraries |
Date: |
Wed, 17 Dec 2003 04:23:18 -0500 (EST) |
Hello!
I've received a bugreport that GNU Midnight Commander cannot be compiled
statically on Gentoo Linux. The fix is to replace "-lglib-2.0" with
"-lglib" in the command line. Midnight Commander doesn't use libtool, but
glib 2.x does. glib also used pkg-config.
Following command is used to request static linking:
./configure LDFLAGS="-Wl,-static"
The configure script blindly trusts the output of pkg-config. That's what
pkg-config developers want us to do - the macro file pkg.m4 comes from
pkg-config. To get the list of the libraries (in the form suitable for
the compiler command line), following command is run:
pkg-config --libs glib-2.0
The result is "-lglib-2.0". pkg-config doesn't know that static linking
was requested. There is no option for that. So the output is the same
for shared and static libraries.
For this to work, libglib-2.0.a should be available to the linker. It
exists on Debian unstable and Fedora Core 1, but not on Gentoo.
It may surprise you, but the existence of libglib-2.0.a appears to be a
workaround for a libtool bug. glib by itself doesn't create versioned
static libraries. And that behavior comes from libtool.
I'm not talking about "correct" versioning with "-version-info", but about
"hard" versioning using the "-release" option.
Let's compile CVS libtool with tests and run following in tests/demo:
./libtool --mode=link gcc -g -O2 -o libhello.la -rpath /usr/local/lib \
-no-undefined -release 5.6 hello.lo foo.lo -lm
libhello-5.6.so is created in .libs, but libhello-5.6.a is not. Neither
is it created during installation.
The problem may be in pkg-config, but if so, I need very good arguments
why libtool doesn't use versioning for static libraries.
My question is - is the lack of versioning for static libraries a
limitation of libtool or is a something that pkg-config should work
around?
I checked the archives and found that proposals to add versioning for
static libraries were posted, but I could not find anything that would
explain position of the libtool developers in this question.
I don't want to add libtool support for GNU Midnight Commander just because
it's linked against glib. If you think it's a good idea, I'd like to hear
arguments.
--
Regards,
Pavel Roskin
- pkg-config and versioning of static libraries,
Pavel Roskin <=