[Top][All Lists]

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

Re: Several questions about libtool

From: Bob Friesenhahn
Subject: Re: Several questions about libtool
Date: Sat, 7 Jan 2012 18:10:32 -0600 (CST)
User-agent: Alpine 2.01 (GSO 1266 2009-07-14)

On Sat, 7 Jan 2012, Russ Allbery wrote:

Bob Friesenhahn <address@hidden> writes:

I think that it is wrong to solely blame libtool for this state of
affairs.  In order for a project to work properly on non-ELF systems, or
where installed shared libraries have abbreviated/truncated ELF implicit
dependencies, or where static libraries are involved, the project needs
to add all dependencies to LIBS during the configure run.

pkg-config is an excellent example of an alternative way of handling this
that does not have this problem, and it includes Autoconf support.

What do you mean by "it includes Autoconf support". Do you mean that it provides an Autoconf macro which makes pkg-config easier to use?

Regardless, Autoconf's configure will still make subsequent decisions based on trial and error (by running the compiler and linker).

One interesting possible solution to this problem would be to eliminate
Libtool *.la files in favor of pkg-config or something similar, rather
than continuing to maintain two different mechanisms for doing largely the
same thing.

They may seem like they do the same thing but perhaps they do 20-30% of the same thing (e.g. dependency info). The .la files used in the build tree are very much needed since it is unlikely that builds will work at all without them (and libtool needs them).

I do agree that a tool can help solve these issues.  The linker itself
is in the best position to know which library dependencies are really
needed and to skip those which are not.

It turns out that this is harder than it looks.  --as-needed causes
obscure failures in places where the dependency really is needed although
the linker can't figure that out.

I suspected as much.

The pkg-config solution allows the maintainer of the library to declare
the necessary behavior for both cases: working transitive dependency
resolution, and situations where this cannot be relied upon.  The build
system then chooses based on the situation.

Pkg-config is optional software which only really works when it is properly cared for and fed correctly. Autotools (as currently defined) can not depend on it. However, we need to determine if there is some way that libtool can work better for modern ELF platforms using only shared libraries while still supporting portability requirements, and use with static libraries.

The obvious "solution" is that there should be a mode in which libtool does not apply any ".la" dependency libraries from an installed .la file unless they are known to be static libraries, or static libraries are otherwise involved. The various .la files listed in dependency_libs would need to be inspected to see if a shared or static library would be used. If any static library would be used, then all of the library dependencies would still need to be applied out of fear that the static library depends on a symbol in a shared library.

Since GNU/Linux disributions have taken the approach of stripping all .la files from the distribution, the above approach becomes more risky to implement.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

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