Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 175785 - libtool shared c++ library with pthread missing symbols
libtool shared c++ library with pthread missing symbols
Product: Fedora
Classification: Fedora
Component: libtool (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
Depends On:
  Show dependency treegraph
Reported: 2005-12-14 17:22 EST by Simon Perreault
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-01-25 08:22:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Simon Perreault 2005-12-14 17:22:15 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.2 (like Gecko)

Description of problem:
I use libtool to generate a C++ library which links against pthread. However     
the resulting library is missing symbols from the pthread library. 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
[nomis80@localhost test]$ cat testcase.cpp 
#include <pthread.h> 
void f() { pthread_create(0,0,0,0); } 
[nomis80@localhost test]$ 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 
[nomis80@localhost test]$ 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/../../.. -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 
(cd .libs && rm -f libtestcase.so && ln -s libtestcase.so.0.0.0 
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) 
[nomis80@localhost test]$ ldd -r .libs/libtestcase.so 
undefined symbol: pthread_create        (.libs/libtestcase.so) 
        linux-gate.so.1 =>  (0x00a0c000) 
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00111000) 
        libm.so.6 => /lib/libm.so.6 (0x00b02000) 
        libc.so.6 => /lib/libc.so.6 (0x0033e000) 
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00e6c000) 
        /lib/ld-linux.so.2 (0x00531000) 

Actual Results:  The pthread_create symbol is missing! 

Expected Results:  The resulting library should be linked against libpthread. 

Additional info:

This bug is also present on FC4 and RHEL4. Note that using gcc instead of g++ 
doesn't trigger the bug because libtool only uses the weird -nostdlib linking 
command line with g++.
Comment 1 Rahul Sundaram 2006-02-20 06:33:30 EST

These bugs are being closed since a large number of updates have been released
after the FC5 test1 and test2 releases. Kindly update your system by running yum
update as root user or try out the third and final test version of FC5 being
released in a short while and verify if the bugs are still present on the system
.Reopen or file new bug reports as appropriate after confirming the presence of
this issue. Thanks
Comment 2 Karsten Hopp 2006-08-01 09:25:13 EDT
please append your testcase to this bugreport
Comment 4 Karsten Hopp 2007-01-25 08:22:48 EST
I've missed that one here:
libtool --mode=link g++ -pthread -rpath /usr/local/lib testcase.lo -o

should have been:
libtool --mode=link g++ -lpthread -pthread -rpath /usr/local/lib testcase.lo -o

which makes it 'NOTABUG'

Note You need to log in before you can comment on or make changes to this bug.