libtool
[Top][All Lists]
Advanced

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

Linking some libraries as static and others as shared


From: dreamcat four
Subject: Linking some libraries as static and others as shared
Date: Sat, 19 Sep 2009 17:28:23 +0100

Hi,
Is there some safe and architecture - independant way to tell libtool
to link one of the libraries statically, with all others remaining
dynamic? This is to produce a php-fpm binary file.

For argument's sake let's call the library "library" in /usr/lib,
meaning there are 2 files there "liblibrary.a" and "liblibrary.so"
So far I have seen 3 ways:

* Prefix with a simicolon and specify the full filename
-l:liblibrary.a  (where filename.a is the static library)
* -lsomesharedlibs --Bstatic -lliblibrary --Bdynamic -lsomesharedlibs
* -static -lliblibrary -dynamic (or -archive -lliblibrary -shared for HP-UX ld)

I tried the first option which works for ubuntu however 2 of my users
came back said it simply doesn't work on CentOS. This make sense as
not all versions of the ld program advertise this -l:filename syntax.
Clearly it might make sense to put some case statement to handle any
os-specific deviations. However i'm fairly dubious that these second
and third options actually stand a chance of working with libtool.

For some reason autoconf / libtool re-arrages the ld flags into it's
own preferred order, rather than the specific order they would need to
be in. So whatever I write in the LDFLAGS variable, libtool will
dutifully come along and spit out -static -dynamic at the beginning of
the link line, then bunch all the libraries together, with
-lliblibrary coming somewhere near the end after all the dynamic ones.

Kindda sucks, to be honest, unless there's some way to getting libtool
not to re-arrange certain flags. Although in all fairness to libtool,
it more seems like only the -lliblibrary flag is the one that is being
moved. There must be some kind of work-around to this. If not, should
i file a bug?


Best regards,

dreamcat4
address@hidden




reply via email to

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