libtool
[Top][All Lists]
Advanced

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

C++ shared library with pthread missing symbols


From: Simon Perreault
Subject: C++ shared library with pthread missing symbols
Date: Wed, 14 Dec 2005 11:01:53 -0500
User-agent: KMail/1.8.2

Why does this create a library with missing symbols?

$ cat testcase.cpp
#include <pthread.h>
void f() { pthread_create(0,0,0,0); }

$ libtool --mode=compile g++ -pthread -c testcase.cpp
mkdir .libs
 g++ -pthread -c testcase.cpp  -fPIC -DPIC -o .libs/testcase.o
 g++ -pthread -c testcase.cpp -o testcase.o >/dev/null 2>&1

$ libtool --mode=link g++ -pthread -rpath /usr/local/lib testcase.lo -o 
libtestcase.la
g++ -shared -nostdlib /usr/lib/gcc/i386-redhat-linux/4.1.0/../../../crti.o 
/usr/lib/gcc/i386-redhat-linux/4.1.0/crtbeginS.o  .libs/testcase.o  
-L/usr/lib/gcc/i386-redhat-linux/4.1.0 
-L/usr/lib/gcc/i386-redhat-linux/4.1.0/../../.. -lstdc++ -lm -lc -lgcc_s 
/usr/lib/gcc/i386-redhat-linux/4.1.0/crtendS.o 
/usr/lib/gcc/i386-redhat-linux/4.1.0/../../../crtn.o  -pthread -Wl,-soname 
-Wl,libtestcase.so.0 -o .libs/libtestcase.so.0.0.0
(cd .libs && rm -f libtestcase.so.0 && ln -s libtestcase.so.0.0.0 
libtestcase.so.0)
(cd .libs && rm -f libtestcase.so && ln -s libtestcase.so.0.0.0 libtestcase.so)
ar cru .libs/libtestcase.a  testcase.o
ranlib .libs/libtestcase.a
creating libtestcase.la
(cd .libs && rm -f libtestcase.la && ln -s ../libtestcase.la libtestcase.la)

$ ldd -r .libs/libtestcase.so
undefined symbol: pthread_create        (.libs/libtestcase.so)
        linux-gate.so.1 =>  (0x00799000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x003a3000)
        libm.so.6 => /lib/libm.so.6 (0x00b89000)
        libc.so.6 => /lib/libc.so.6 (0x00cc7000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x008b1000)
        /lib/ld-linux.so.2 (0x00531000)

$ g++ --version
g++ (GCC) 4.1.0 20051212 (Red Hat 4.1.0-0.7)

$ libtool --version
ltmain.sh (GNU libtool) 1.5.20 (1.1220.2.287 2005/08/31 18:54:15)

Thanks!




reply via email to

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