[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libtool does not add stdc++ when linking on Linux
From: |
Christian Thalinger |
Subject: |
libtool does not add stdc++ when linking on Linux |
Date: |
Wed, 18 Jun 2008 17:09:40 +0200 |
Hi!
I am compiling some C files and one C++ with GCC and linking them into
a .a library (libvm.a). The resulting libvm.la misses the stdc++
dependency on Linux, while it is there on OpenSolaris:
Linux:
$ cat src/vm/libvm.la | grep libs=
dependency_libs=' '
OpenSolaris:
$ cat src/vm/libvm.la | grep libs=
dependency_libs='
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../amd64/libstdc++.la
-L/usr/sfw/lib/amd64 -lgcc_s'
This is both:
$ ./libtool --version
ltmain.sh (GNU libtool) 2.2.4
The link tag used for both is --tag=CC. These are the linking commands
of the final .so library:
Linux:
/bin/sh ../../libtool --tag=CC --mode=link gcc -std=c99 -pedantic -Wall
-Wno-long-long -m64 -D__X86_64__ -D__LINUX__ -D_POSIX_C_SOURCE=200112L
-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_REENTRANT
-o libjvm.la -rpath /usr/local/cacao/lib -version-info
1:0:0 ../../src/fdlibm/libfdlibm.la ../../src/mm/libmm.la
../../src/native/libnative.la ../../src/threads/libthreads.la
../../src/toolbox/libtoolbox.la ../../src/vm/libvm.la
../../src/vmcore/libvmcore.la -lz -lpthread -lopcodes -lbfd -liberty -ldl
libtool: link: gcc -shared
-Wl,--whole-archive ../../src/fdlibm/.libs/libfdlibm.a
../../src/mm/.libs/libmm.a ../../src/native/.libs/libnative.a
../../src/threads/.libs/libthreads.a ../../src/toolbox/.libs/libtoolbox.a
../../src/vm/.libs/libvm.a ../../src/vmcore/.libs/libvmcore.a
-Wl,--no-whole-archive -lz -lpthread -lopcodes -lbfd -liberty -ldl -m64
-Wl,-soname -Wl,libjvm.so.1 -o .libs/libjvm.so.1.0.0
OpenSolaris:
/bin/sh ../../libtool --tag=CC --mode=link gcc -std=c99 -pedantic
-Wall -Wno-long-long -m64 -D__X86_64__ -D__SOLARIS__
-D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_BSD_SOURCE
-D_XOPEN_SOURCE=600 -D_REENTRANT -O0 -g -version-info 1:0:0 -o
libjvm.la
-rpath /usr/local/cacao/lib ../../src/fdlibm/libfdlibm.la
../../src/mm/libmm.la ../../src/native/libnative.la
../../src/threads/libthreads.la ../../src/toolbox/libtoolbox.la
../../src/vm/libvm.la ../../src/vmcore/libvmcore.la -lz -lpthread -ldl
-lsocket
libtool: link: gcc -shared -Wl,-z -Wl,text -Wl,-h -Wl,libjvm.so.1
-o .libs/libjvm.so.1.0.0 -Wl,-z
-Wl,allextract ../../src/fdlibm/.libs/libfdlibm.a ../../src/mm/.libs/libmm.a
../../src/native/.libs/libnative.a ../../src/threads/.libs/libthreads.a
../../src/toolbox/.libs/libtoolbox.a ../../src/vm/.libs/libvm.a
../../src/vmcore/.libs/libvmcore.a -Wl,-z -Wl,defaultextract
-R/usr/sfw/lib/amd64 -R/usr/sfw/lib/amd64 -lrt /usr/sfw/lib/amd64/libstdc++.so
-L/usr/sfw/lib/amd64 -lgcc_s -lz -lpthread -ldl -lsocket -lc -m64
Any idea why the dependency is missing on Linux?
- twisti