libtool
[Top][All Lists]
Advanced

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

Re: HP-UX "module" linking problem


From: Albert Chin
Subject: Re: HP-UX "module" linking problem
Date: Mon, 18 Sep 2006 23:46:03 -0500
User-agent: Mutt/1.5.6i

On Tue, Sep 19, 2006 at 12:29:50AM +0200, Kent Boortz wrote:
> 
> On HP-UX 11.11 PA-RISC I try create a "module" that is loadable using
> "libltdl". When creating the module, I try link against a static
> library "libmysqlclient". This fails.
> 
>   OS      : HP-UX B.11.11 (hppa)
>   c.guess : hppa2.0w-hp-hpux11.11
>   libtool : 1.5.22
>   cc      : HP92453-01 B.11.11.12 HP C Compiler
>   ld      : HP92453-07 B.11.41 040909
> 
> The final link does (removing the -I<path>, -L<path> and optimizer flags)
> 
>   % /bin/sh ../libtool --tag=CC --mode=link cc +DAportable -g \
>       -o libmyodbc3_r.la -rpath <rpath> -release 3.51.13 <.lo-files> \
>       ../myodbc3u/libmyodbc3u.la ../MYODBCDbg/MYODBCDbgLib/libMYODBCDbg.la \
>       <instbase>/libtool/lib/libltdl.la -lmysqlclient_r \
>       -lz -lpthread -lnsl -lm -liodbcinst
> 
> "libmysqlclient_r" is a static library compiled with "--with-pic", i.e. +Z.
> "libiodbcinst" is a shared library.
> 
> Libtool complains with
> 
>   *** Warning: This system can not link to static lib archive 
> /home/mysqldev/odbc/inst/libtool/lib/libltdl.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.
> 
>   *** Warning: Trying to link with static lib archive libmysqlclient_r.a.
>   *** 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
>   *** because the file extensions .a of this argument makes me believe
>   *** that it is just a static archive that I should not used here.
> 
> but produces a shared library, just *without* "libmysqlclient_r".If I
> copy the expanded link line and insert "<path>/libmysqlclient_r.a", it
> links ok, So why this complaint? How to I convince libtool not to
> remove this static library from the generated link line?

I don't get it. I'm not getting the same results:
  $ file /opt/TWWfsw/zlib11s/lib/libz.a
  /opt/TWWfsw/zlib11s/lib/libz.a: archive file -PA-RISC1.1 relocatable library

Using the latest libtool-1.5 from CVS:
  $ /opt/TWWfsw/libtool15/bin/libtool --mode=link cc -g a.lo \
  -L/opt/TWWfsw/zlib11s/lib -lz -rpath /tmp/ti -o liba.la 

  *** Warning: This system can not link to static lib archive 
/opt/TWWfsw/zlib11s/lib/libz.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.
  rm -fr  .libs/liba.a .libs/liba.la .libs/liba.lai .libs/liba.sl 
.libs/liba.sl.0 .libs/liba.sl.0.0
  cc -b -Wl,+h -Wl,liba.sl.0 -Wl,+b -Wl,/tmp/ti -o .libs/liba.sl.0.0  .libs/a.o 
 -L/opt/TWWfsw/zlib11s/lib -lc   
  (cd .libs && rm -f liba.sl.0 && ln -s liba.sl.0.0 liba.sl.0)
  (cd .libs && rm -f liba.sl && ln -s liba.sl.0.0 liba.sl)
  ar cru .libs/liba.a  a.o
  ranlib .libs/liba.a
  creating liba.la
  (cd .libs && rm -f liba.la && ln -s ../liba.la liba.la)

  $ /opt/TWWfsw/libtool15/bin/libtool --mode=link cc -g a.lo \
  /opt/TWWfsw/zlib11s/lib/libz.a -rpath /tmp/ti -o liba.la 

  *** Warning: Trying to link with static lib archive 
/opt/TWWfsw/zlib11s/lib/libz.a.
  *** 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
  *** because the file extensions .a of this argument makes me believe
  *** that it is just a static archive that I should not used here.
  rm -fr  .libs/liba.a .libs/liba.la .libs/liba.lai .libs/liba.sl 
.libs/liba.sl.0 .libs/liba.sl.0.0
  cc -b -Wl,+h -Wl,liba.sl.0 -Wl,+b -Wl,/tmp/ti -o .libs/liba.sl.0.0  .libs/a.o 
 -lc 
  (cd .libs && rm -f liba.sl.0 && ln -s liba.sl.0.0 liba.sl.0)
  (cd .libs && rm -f liba.sl && ln -s liba.sl.0.0 liba.sl)
  ar cru .libs/liba.a /opt/TWWfsw/zlib11s/lib/libz.a  a.o 
/opt/TWWfsw/zlib11s/lib/libz.a
  ranlib .libs/liba.a
  creating liba.la
  (cd .libs && rm -f liba.la && ln -s ../liba.la liba.la)

So, in both cases, libz is not on the command-line used to create the
shared library.

On HP-UX, lib*.a libraries are always static archives, regardless of
how the members were compiled. If you want to link in
libmysqlclient_r, I think your only solution is to build it as part of
whatever program you're building but create it as a convenience
library.

-- 
albert chin (address@hidden)




reply via email to

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