Subject: bug#13550: problem with linking libpthread

From: Petr Hracek <[email-masked]>
Date: Mon, 28 Jan 2013 09:33:00 +0100

Hello,

libtool --config | grep _path returns
sys_lib_search_path_spec="/usr/lib/gcc/i686-redhat-linux/4.7.2 /usr/lib 
/lib "
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib "
compiler_lib_search_path=""

after correcting -rpath
to libtool --mode=link -rpath /usr/lib -lpthread testcase.lo -o 
libtestcase.la
all works fine.
$~> libtool --mode=link g++ -rpath /usr/lib -lpthread testcase.lo -o 
libtestcase.la
libtool: link: rm -fr  .libs/libtestcase.a .libs/libtestcase.la 
.libs/libtestcase.lai .libs/libtestcase.so .libs/libtestcase.so.0 
.libs/libtestcase.so.0.0.0
libtool: link: g++  -fPIC -DPIC -shared -nostdlib 
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../crti.o 
/usr/lib/gcc/i686-redhat-linux/4.7.2/crtbeginS.o  .libs/testcase.o 
-lpthread -L/usr/lib/gcc/i686-redhat-linux/4.7.2 
-L/usr/lib/gcc/i686-redhat-linux/4.7.2/../../.. -lstdc++ -lm -lc -lgcc_s 
/usr/lib/gcc/i686-redhat-linux/4.7.2/crtendS.o 
/usr/lib/gcc/i686-redhat-linux/4.7.2/../../../crtn.o    -Wl,-soname 
-Wl,libtestcase.so.0 -o .libs/libtestcase.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libtestcase.so.0" && ln -s 
"libtestcase.so.0.0.0" "libtestcase.so.0")
libtool: link: (cd ".libs" && rm -f "libtestcase.so" && ln -s 
"libtestcase.so.0.0.0" "libtestcase.so")
libtool: link: ar cru .libs/libtestcase.a  testcase.o
libtool: link: ranlib .libs/libtestcase.a
libtool: link: ( cd ".libs" && rm -f "libtestcase.la" && ln -s 
"../libtestcase.la" "libtestcase.la" )
$~> ldd -r .libs/libtestcase.so
     linux-gate.so.1 =>  (0xb7730000)
     libpthread.so.0 => /lib/libpthread.so.0 (0xb76f7000)
     libstdc++.so.6 => /lib/libstdc++.so.6 (0xb760b000)
     libm.so.6 => /lib/libm.so.6 (0xb75e0000)
     libc.so.6 => /lib/libc.so.6 (0xb742e000)
     libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7410000)
     /lib/ld-linux.so.2 (0x4abcd000)
$~>

Thank you

best regards
Petr

On 01/25/2013 10:44 PM, Roumen Petrov wrote:
> Petr Hracek wrote:
>> Hi Folks,
>>
>> I have received bug which seems to be relevant to libtool
>> https://bugzilla.redhat.com/show_bug.cgi?id=661333
>> []
>>
>> How can it be solved? 
> Dunno.
>
>> It seems to be a bug in libtool, right?
> No. All is fine in my environment where most of packages are without 
> vendor patches and linux distribution is different.
>
>> Can it be a problem with ordering of lib flags in libtool?
> May be you cannot use -rpath /lib in you build environment (1% 
> probability).
>
> Check libtool configuration for search path
> $ libtool --config | grep _path
>
> Note if you change compiler you must rebuild libtool.
> Some projects force root library directory to be before user path in 
> 'library search path' and usual result is link failure.
>
> Roumen
>
>
>
>
> _______________________________________________
> Bug-libtool mailing list
> [email-masked]
> https://lists.gnu.org/mailman/listinfo/bug-libtool