[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libtool 1.5.20, Solaris, linking in static libraries into the shared
From: |
Ralf Wildenhues |
Subject: |
Re: libtool 1.5.20, Solaris, linking in static libraries into the shared libraries |
Date: |
Mon, 31 Oct 2005 14:06:47 +0100 |
User-agent: |
Mutt/1.5.11 |
Hi Yuri,
* Pooh wrote on Mon, Oct 31, 2005 at 11:31:24AM CET:
>
> There is a following problem using CC v5.5 (v5.6 from Studio 10 does
> show the same behaviour).
> I compile the sources (attached).
> test1 prints the message, while test2 doesn't.
>
> That is because when we compile static library into the shared, using
> the string:
(Side note: you mean what in Libtool lingo is called a `convenience
archive' rather than a static library; the objects in the archive
contain position-independent code, PIC).
> libtool --mode=link CC -rpath /tmp -o libcon2.la dummy.lo libcon.la
> It becomes:
> CC -G -hlibcon2.so.0 -o .libs/libcon2.so.0.0.0 .libs/dummy.o -Qoption
> ld -z -Qoption ld allextract,./.libs/libcon.a -Qoption ld -z -Qoption ld
> defaultextract -lCstd -lCrun -lc
> Which is considered wrong, the string must look like:
> CC -G -hlibcon2.so.0 -o .libs/libcon2.so.0.0.0 .libs/dummy.o -z
> allextract ./.libs/libcon.a -z defaultextract -lCstd -lCrun -lc
> As stated here: http://forum.sun.com/thread.jspa?threadID=27249&tstart=0
There is a partly related bugfix pending:
http://lists.gnu.org/archive/html/libtool-patches/2005-10/msg00111.html
Does
CC -G -hlibcon2.so.0 -o .libs/libcon2.so.0.0.0 -z \
allextract ./.libs/libcon.a -z defaultextract -lCstd -lCrun -lc
work as well? For which compiler/Solaris versions (print `CC -V')?
(I assume not, that's probably why you added the dummy.lo in the first
place, right?)
> PS. *giggle* I remember that some time ago this has been changed into
> the current form because of a problem with CC5.3 on Solaris 8.
Yes, I know. On CVS HEAD, I'll probably just set
whole_archive_flag_spec=
so libtool will do the extracting and not use `allextract' at all,
because of above mentioned dummy-bug.
> On 5.3 it still doesn't work in any form. But on 5.5 and 5.6 it helps.
> So the idea "wl=-z" looks better and better:)
What I haven't understood yet is why we use `-Qoption' at all. There
must be some combination where `-z' doesn't work as expected. (Haven't
checked the archives for this yet..)
By the way, another question (since you seem to have access to a number
of compiler/system version): Does the addition of `-lCstd -lCrun' cause
the C++ library symbols to be copied into the created library, or are
they linked dynamically? If the former: for which compiler/system
versions? You should read this thread for more info on this:
http://lists.gnu.org/archive/html/libtool/2005-08/msg00088.html
If you can provide additional useful information, the better, but be
sure to always specify which compiler/system versions you are speaking
about.
Thanks,
Ralf