[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
multi part library?
multi part library?
Tue, 23 Mar 2004 12:21:28 +0100
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 = ...
lib_LTLIBRARIES = libA1.la
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/Makefile.am to
and link the other libs with -lB
(or point to the libB.la 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 libA1.so 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/Makefile.am to
libtool/automake will do what i want.
libB.a has the non PIC code, .libs/libB.al has the PIC code.
but if I change A1/Makefile.am to
libA1_la_LIBADD = $(top_builddir)/B/.libs/libB.al
then libtool will silently ignore it, and not link
so my fix for now is this:
libA1_la_LIBADD = dummy.lo
cp $(top_builddir)/B/.libs/libB.al dummy.lo
that results in the libA1.so 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.
- multi part library?,
Andreas Jellinghaus <=