[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hpux linking shared library with static library
From: |
Alon Bar-Lev |
Subject: |
Re: hpux linking shared library with static library |
Date: |
Thu, 15 Jul 2010 07:38:40 +0300 |
Hello Robert,
This argument is correct, however it is true for all platforms, while
this already works using libtool in:
- Windows 32bit
- Windows 64bit
- Solaris 8
- Solaris 10 sparc
- Solaris 10 intel
- AIX 5.3
- AIX 6.1
- Linux 2.2 i386
- Linux 2.4 i386
- Linux 2.6 i686
- Linux 2.6 x86_64
- Linux 2.6 ppc
- Linux 2.6 s390
Something must be different in hpux configuration, while it can
behave like any other OS, libtool enforces something else.
Thanks,
Alon.
On Wed, Jul 14, 2010 at 7:20 PM, Robert Boehne <address@hidden> wrote:
> Libtool is intended to support a portable subset of shared library
> functionality. When you use an archive file to create a shared library,
> this is generally not a portable feature, and won't work on many systems
> (like Windows).
>
> In this situation, you will be better off creating a shared library of the
> archive you want to link in, or expanding it into it's object files and
> linking them directly (like a Libtool convenience library). But whatever
> you may do, if you get an archive that isn't pic, it won't work, and because
> the one advantage to static archives is that they don't have to be pic (and
> may run a little faster) most of them are created from object files that are
> not pic.
>
> HTH,
>
> Rob
>
> On Wed, Jul 14, 2010 at 2:47 AM, Alon Bar-Lev <address@hidden> wrote:
>>
>> Thank you!
>>
>> But I do link the static library as PIC.
>>
>> Attached is a sample.
>>
>> When I remove the restriction all works, shared can call static, main
>> can call both.
>> ---
>> $ ldd xxx/bin/test1
>> =>
>> /usr/lib/libc.2 => /usr/lib/libc.2
>> /usr/lib/libdld.2 => /usr/lib/libdld.2
>> /usr/lib/libc.2 => /usr/lib/libc.2
>> /tmp/alon/test-1/xxx/lib/libb.sl =>
>> /tmp/alon/test-1/xxx/lib/libb.sl
>> /usr/lib/libc.2 => /usr/lib/libc.2
>> $ xxx/bin/test1
>> ---
>>
>> ---
>> AUTOMAKE_OPTIONS = foreign 1.10
>> ACLOCAL_AMFLAGS = -I m4
>>
>> noinst_LTLIBRARIES = liba.la
>> lib_LTLIBRARIES = libb.la
>> bin_PROGRAMS = test1
>>
>> liba_la_SOURCES = a.c
>> liba_la_CFLAGS = $(AM_CFLAGS) -prefer-pic
>> liba_la_LDFLAGS= $(AM_LDFLAGS) -rpath $(libdir) -static
>>
>> libb_la_SOURCES = b.c libb.exports
>> libb_la_LIBADD = liba.la
>> libb_la_LDFLAGS = $(AM_LDFLAGS) \
>> -avoid-version -no-undefined \
>> -export-symbols $(srcdir)/libb.exports
>>
>> test1_SOURCES = c.c
>> test1_LDADD = libb.la
>> ---
>>
>> On Tue, Jul 13, 2010 at 7:30 PM, Robert Boehne <address@hidden> wrote:
>> >
>> > When your shared library links, that doesn't mean it will work. You
>> > would need to run a program with it, that uses symbols in the archive
>> > you've
>> > attempted to link to your shared library.
>> >
>> > IIRC, HPUX will generate non-pic by default and your link may not be
>> > resolving anything in the static archive.
>> >
>> >
>> > On Tue, Jul 13, 2010 at 11:09 AM, Alon Bar-Lev <address@hidden>
>> > wrote:
>> >>
>> >> Hello,
>> >>
>> >> When I try to link shared library with static library on hpux I get
>> >> the following message:
>> >> """
>> >> *** Warning: This system can not link to static lib archive libcore.la.
>> >> *** I have the capability to make that library automatically link in
>> >> when
>> >> *** you link to this library. But I can only do this if you have a
>> >> *** shared version of the library, which you do not appear to have.
>> >> *** But as you try to build a module library, libtool will still create
>> >> *** a static module, that should work as long as the dlopening
>> >> application
>> >> *** is linked with the -dlopen flag to resolve symbols at runtime.
>> >> """
>> >>
>> >> However if I change libtool:
>> >> -deplibs_check_method="file_magic
>> >> (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library"
>> >> +deplibs_check_method="pass_all"
>> >>
>> >> It succeed in linking.
>> >>
>> >> Any reason why this is forbidden in hpux?
>> >>
>> >> $ uname -a
>> >> HP-UX hpux1 B.11.11 U 9000/800 1528720528 unlimited-user license
>> >>
>> >> Regards,
>> >> Alon Bar-Lev.
>> >>
>> >> _______________________________________________
>> >> http://lists.gnu.org/mailman/listinfo/libtool
>> >
>
>