[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question regarding interdependent convenience libraries
From: |
Ralf Wildenhues |
Subject: |
Re: Question regarding interdependent convenience libraries |
Date: |
Thu, 3 May 2007 08:42:56 +0200 |
User-agent: |
Mutt/1.5.15 (2007-04-13) |
* Bob Friesenhahn wrote on Thu, May 03, 2007 at 06:00:22AM CEST:
> On Wed, 2 May 2007, Scott D. Fleming wrote:
>>
>> Is libtool or the underlying linker smart enough to recognize and
>> ignore the duplicate libraries?
>
> I think that the content of convenience libraries is extracted into
> individual .o files prior to being used for linkage.
This is true if the linker doesn't have a functionality similar to
--whole-archive, and if the resulting output is a library, rather than a
program.
> They are not used for
> linking like traditional archive libraries. This means that any duplicates
> would result in individual .o files being overwritten prior to use.
This is not true. When extracted, object files with identical names are
renamed.
> In other words non-fatal for building applications. However, if you
> build installed libraries based on these convenience libraries, you
> could run into trouble if two installed libraries included some of the
> same objects.
The rule of thumb is to put each convenience archive in at most one
library, and never into a program. (Convenience archives do not end
up as whole in a program; if that is not a problem for you, then that
part should be ok.)
> A radically-different solution is to use a non-recursive Makefile scheme.
> This eliminates the need for convenience libraries entirely and speeds up
> the build. Automake does support this reasonably well and you can use
> Makefile includes to still keep Makefile fragments alongside the sources.
> However, the Makefile fragments require "namespacing" as if everything is
> referenced from the top level Makefile (which they will be).
This is a good suggestion.
Cheers,
Ralf