Subject: libtool, C++ and shared objects
To: None <skrll@netbsd.org>
From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
List: tech-pkg
Date: 08/18/2001 03:40:11
Hi,

I just run into an annoying feature of libtool. I'm trying to compile a
xmms-plugin, which works as shared object (.so, no version). As the code
is C++, the shared object needs to be linked against libgcc so
__builtin_new is resolved properly. If I add -lgcc to the c++ command that
libtool runs, this works fine. If I add the same -lgcc line to the libtool
command linking things, libtool warns me that I'll need a libgcc, but then
discards(!) the one I give it on the command line explicitly. 

Is there something that can be done against that?


 - Hubert

Here's the typescript. Note the -lgcc in the libtool call, but not in the
c++ call:

miyu# /bin/sh ./libtool --mode=link c++
-I/usr/cvs/pkgsrc/audio/xmms-gforce.work/work.i386/.buildlink/include -O2
-DUNIX_X -D_REENTRANT
-L/usr/cvs/pkgsrc/audio/xmms-gforce.work/work.i386/.buildlink/lib
-Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib
-Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -o
libgforce.la -rpath /usr/pkg/lib/xmms/Visualization -avoid-version null.lo
_Unix-X/xmms/libxmmsp.la _Unix-X/unixbase/libunixbase.la
_G-Force_Common/libgforce.la Common/io/libio.la Common/math/libmath.la
Common/UI/libUI.la Common/General_Tools/libgt.la _Unix-X/libmfl/libmfl.la
_Unix-X/libxpce/libxpce.la -lXext -lintl -lSM -lICE -L/usr/X11R6/lib -lgcc
rm -fr  .libs/libgforce.a .libs/libgforce.la .libs/libgforce.lai
.libs/libgforce.so

*** Warning: This library needs some functionality provided by -lgcc.
*** 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.
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.
c++ -shared -nodefaultlibs  .libs/null.o -Wl,--whole-archive
_Unix-X/xmms/.libs/libxmmsp.a _Unix-X/unixbase/.libs/libunixbase.a
_G-Force_Common/.libs/libgforce.a Common/io/.libs/libio.a
Common/math/.libs/libmath.a Common/UI/.libs/libUI.a
Common/General_Tools/.libs/libgt.a _Unix-X/libmfl/.libs/libmfl.a
_Unix-X/libxpce/.libs/libxpce.a -Wl,--no-whole-archive  -Wl,--rpath
-Wl,/usr/pkg/lib -Wl,--rpath -Wl,/usr/pkg/lib
-L/usr/cvs/pkgsrc/audio/xmms-gforce.work/work.i386/.buildlink/lib
-L/usr/X11R6/lib -L/usr/pkg/lib _Unix-X/xmms/.libs/libxmmsp.a
_Unix-X/unixbase/.libs/libunixbase.a _G-Force_Common/.libs/libgforce.a
Common/io/.libs/libio.a Common/math/.libs/libmath.a
Common/UI/.libs/libUI.a Common/General_Tools/.libs/libgt.a
_Unix-X/libmfl/.libs/libmfl.a _Unix-X/libxpce/.libs/libxpce.a -lXext
/usr/pkg/lib/libintl.so -lSM -lICE  -Wl,-R/usr/X11R6/lib
-Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -Wl,-R/usr/pkg/lib -Wl,-soname
-Wl,libgforce.so -o .libs/libgforce.so


-- 
Want to get a clue on IPv6 but don't know where to start? Try this:
* Basics -> http://www.onlamp.com/pub/a/onlamp/2001/05/24/ipv6_tutorial.html
* Setup  -> http://www.onlamp.com/pub/a/onlamp/2001/06/01/ipv6_tutorial.html 
Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/