[Top][All Lists]

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

multi part library?

From: Andreas Jellinghaus
Subject: multi part library?
Date: Tue, 23 Mar 2004 12:21:28 +0100
User-agent: Pan/0.14.0 (I'm Being Nibbled to Death by Cats!)


how to build a multi part library?
i.e. source is in A1/ A2/ and B/.
libA1 is meant to be built from A1/* and B/*,
libA2 is meant to be built from A2/* and B/*.

what people do is this:
noinst_LIBRARIES = libB.a
libB_a_SOURCES = ...

libA1_la_SOURCES = ...
libA1_la_LIBADD = $(top_builddir)/B/libB.a

same for A2.

This does not work. libB.a is build from non-pic code,
and you cannot create a shared libA1 library by mixing
PIC and non-PIC code.

But on x86 nobody notices, it compiles fine and works.
On x86_64 however it does not even compile.

What is the best solution to this problem?

Of course I could make B a real shared library,
change B/ to
and link the other libs with -lB
(or point to the file).

But I don't want to do that, not polute the system
with hundreds of shared libraries not meant to be used
by anything but the real libraries.

I realy want this:
 - compile all files in B/ with pic and non PIC code
 - create a PIC and a non PIC libB.a file.
 - create from the PIC libB.a file
 - create libA1.a from the non PIC libB.a file.

the last is optional. and an error here (using the PIC
libB.a file) should not hurt, I guess.

if I change B/ to
libtool/automake will do what i want.
libB.a has the non PIC code, .libs/ has the PIC code.

but if I change A1/ to
        libA1_la_LIBADD = $(top_builddir)/B/.libs/
then libtool will silently ignore it, and not link

so my fix for now is this:
        libA1_la_LIBADD = dummy.lo

        dummy.lo: $(top_builddir)/B/.libs/
                cp $(top_builddir)/B/.libs/ dummy.lo

that results in the build from PIC code which
is what I want. And still the package only installs two
libraries - A1 and A2 - and not more.

I guess there is a better way to do this.
Could you tell me how?

Thanks for your help.

Regards, Andreas

reply via email to

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