libtool
[Top][All Lists]
Advanced

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

Re: C++ shared library with pthread missing symbols


From: Ralf Wildenhues
Subject: Re: C++ shared library with pthread missing symbols
Date: Thu, 15 Dec 2005 08:22:48 +0100
User-agent: Mutt/1.5.11

Hi Simon,

* Simon Perreault wrote on Wed, Dec 14, 2005 at 05:01:53PM CET:
> Why does this create a library with missing symbols?

I believe pecause -nostdlib will cause gcc not to add -lpthread even if
-pthread is given.  Could you file a bug with the GCC bugzilla (to
either fix the semantics or adjust the documentation)?  Thanks.

It may not be trivial to work around within libtool.  You can
probably LDFLAGS=-lpthread to work around in your special case.

> $ 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)

Cheers,
Ralf




reply via email to

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