libtool
[Top][All Lists]
Advanced

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

Re: Splitting dependency_libs in *.la?


From: Kurt Roeckx
Subject: Re: Splitting dependency_libs in *.la?
Date: Tue, 3 Oct 2006 21:14:37 +0200
User-agent: Mutt/1.5.9i

On Mon, Oct 02, 2006 at 05:26:43PM -0500, Albert Chin wrote:
> > Debian has a patch that sets link_all_deplibs to no.  This basicly
> > doesn't use dependency_libs for shared linking.  Note that this causes
> > various problems for which there are open bugs in the Debian bug
> > tracking system.
> > 
> > Because of this, Debian is more and more moving from .la files to using
> > pkg-config's .pc files, which contains the info we need, and also has
> > cflags (-Is) in it.
> 
> If you add LDFLAGS="-Wl,--as-needed", then linking against
> dependency_libs shouldn't matter. But, that only helps if you use a
> recent version of GNU ld.

You don't want to use --as-needed in all cases.  You sometimes need to
be linked to a library, even if you don't appear to be using it.  One
example is the use of constructors/destructors in the library.

Also, libtool has a problem with it, since it can reorder things.  See
http://bugs.debian.org/347650

> And, even for .pc files, it doesn't mean you get _only_ the libraries
> you need. What if someone has "Requires: -lpng -lz" in a .pc file?
> Then you have a dependency on libpng and libz, which is unnecessary as
> libpng already depends on libz.

What you mean is:
Libs: -lpng -lz

But you really should use:
Libs.private: -lpng -lz

Or:
Requires.private: libpng

The Libs are used for all linking, the Libs.private only for static
linking.  The same goes for Requires and Requires.private.

Anyway, when you make a library, and you use both libpng and libz, you
should yourself link to both of them.  If you only make use of libpng,
and don't use libz yourself, you should only link to libpng if you're
linking shared.  But that doesn't say anything about applications that
try to link to your library, since they really should only link to
yours if linking shared, and to all 3 if linking static.

> I don't see how libtool can intelligently decide the minimum set of
> libraries needed to satisfy the link.

It should just use whatever to user said to use.


Kurt





reply via email to

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