[Top][All Lists]

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

Re: Q: library dependencies

From: Nick Bowler
Subject: Re: Q: library dependencies
Date: Thu, 24 Sep 2020 15:17:01 -0400

On 2020-09-24, Oleg Smolsky <> wrote:
> Hello, I'm working on an autotools-based build system and finally decided to
> look into these messages:
> copying selected object files to avoid basename conflicts...
> It looks like libtool links (copies?) .o files when it finds a dupe in the
> dependency DAG. Here is the situation I have w.r.t. the dependencies:
> All these libraries are static, noinst_LILIBRARIES and the dependencies are
> expressed via _LIBADD syntax:
> libtop_la_LIBADD =
> I do this to get transitive dependencies where the top-level executable just
> needs to link to link
> I think the issue is with as it is present in two different branches
> of the dependency DAG. This kind of thing is common in large projects and
> seems strange that libtool is trying to be smart about it.
> Is there a way to tell automake/libtool to disable this copying and just do
> straightforward linking? I wonder if the current behavior results in
> unnecessary bloat?.. Or perhaps I am saved by the linker that would dedup?

Unless I misunderstand something, what you describe is the documented
and expected behaviour.

When using primaries such as noinst_LTLIBRARIES, Automake will generate
rules that create libtool convenience libraries.  Such libraries are
basically intended to be a convenient shorthand for directly listing
the libtool objects that make up the convenience library whenever you
use libtool to link with it.

So when you create another libtool convenience library,, linking
with, since is a shorthand for directly listing all
its objects this creates a new library that contains all the objects
that made up

Now when creating the convenience library, you link against
_both_ convenience libraries and  This directly includes
all the objects of and all the objects of  But as the
objects of are duplicated in, this means some objects
are to be included twice into  Libtool has to rename one of
the objects to make this work (hence the "copying ... to avoid basename

I assume this is not the desired result.  Probably simplest to just
arrange for to either be a dependency of OR,
but not both.


reply via email to

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