Bug 175785 - libtool shared c++ library with pthread missing symbols
Summary: libtool shared c++ library with pthread missing symbols
Alias: None
Product: Fedora
Classification: Fedora
Component: libtool (Show other bugs)
(Show other bugs)
Version: 5
Hardware: i386 Linux
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-12-14 22:22 UTC by Simon Perreault
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

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

Attachments (Terms of Use)

Description Simon Perreault 2005-12-14 22:22:15 UTC
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 11:33:30 UTC

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 13:25:13 UTC
please append your testcase to this bugreport

Comment 4 Karsten Hopp 2007-01-25 13:22:48 UTC
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.