[Top][All Lists]

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

Re: [PATCH] Don't install .la files when --no-la-files is used

From: Russ Allbery
Subject: Re: [PATCH] Don't install .la files when --no-la-files is used
Date: Sat, 08 Nov 2008 13:15:21 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Roumen Petrov <address@hidden> writes:

> It was old build bug when building readline library on some linux-es. In
> my memory is suse 7.1 but I'm sure that only this particular version was
> affected.

> Many other linux verdors build readline without dependent libraries and
> this allow application to be linked against different curses compatible
> libraries.

libreadline is linked against libncurses on Debian.

But surely it's obvious that this isn't an interesting argument and has
nothing to do with my point?  It may be that my specific example doesn't
apply on the system that you're looking at right now, but I'm sure that
you can find dozens or hundreds of others without even trying.  Any shared
library that is linked with other shared libraries and is built with
libtool can present this problem.

The best practice for distribution-packaged shared libraries and binaries
is that they should only be linked against shared libraries whose ABIs
they use directly.  They should never be linked against shared libraries
that they use only indirectly, since doing so adds unnecessary
dependencies and unnecessary rebuild work when the SONAMEs of those
additional shared libraries change.  The same issue applies to any large
local software installation.

libtool does not follow this best practice unless you delete the installed
*.la files or use --as-needed (which as a linker flag doesn't seem to be
reliable or robust as yet -- I do apologize if --as-needed referred to
some libtool-specific feature I didn't know about instead of the GNU ld
flag).  One of the problems with the GNU ld --as-needed flag is that it
applies indiscriminately to all linked libraries, even ones that the
application maintainer added explicitly (rather than being added
implicitly by libtool), and sometimes does the wrong thing with libraries
that are actually needed.

The desired behavior of libtool from a distribution perspective would be
to not include dependency libraries from the *.la file in the link on
platforms known to have proper transitive dependency support unless a
static link was requested.  (There would need to be a flag to override
this for the unusual cases where this is required; there are some edge
cases where it's needed, usually involving things like weak symbols or
other corner cases.)

Russ Allbery (address@hidden)             <>

reply via email to

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