libtool
[Top][All Lists]
Advanced

[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: Wed, 14 Jul 2010 10:47:31 +0300

‎‎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
>

Attachment: test.tar.gz
Description: GNU Zip compressed data


reply via email to

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