GNU bug report logs - #13550
problem with linking libpthread

Previous Next

Package: libtool;

Reported by: Petr Hracek <phracek <at> redhat.com>

Date: Fri, 25 Jan 2013 16:59:01 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Petr Hracek <phracek <at> redhat.com>
To: bug-libtool <at> gnu.org
Subject: problem with linking libpthread
Date: Fri, 25 Jan 2013 17:57:51 +0100
Hi Folks,

I have received bug which seems to be relevant to libtool
https://bugzilla.redhat.com/show_bug.cgi?id=661333

it refers to:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460

$ ~> cat testcase.cpp
#include <pthread.h>

void f(){ pthread_create(0,0,0,0); }
$ ~> libtool --mode=compile g++ -pthread -c testcase.cpp
libtool: compile:  g++ -pthread -c testcase.cpp  -fPIC -DPIC -o 
.libs/testcase.o
libtool: compile:  g++ -pthread -c testcase.cpp -o testcase.o >/dev/null 
2>&1
$ ~> libtool --mode=link g++ -pthread -rpath /lib/ testcase.lo -o 
libtestcase.la
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 
-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  -pthread -pthread 
-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 =>  (0xb7719000)
    libstdc++.so.6 => /lib/libstdc++.so.6 (0xb760e000)
    libm.so.6 => /lib/libm.so.6 (0xb75e3000)
    libc.so.6 => /lib/libc.so.6 (0xb7431000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7414000)
    /lib/ld-linux.so.2 (0x4abcd000)
undefined symbol: pthread_create    (.libs/libtestcase.so)
$ ~>

library libpthread is not linking with my object file

versions of libtool and g++ are:
$ ~> libtool --version
libtool (GNU libtool) 2.4.2
Written by Gordon Matzigkeit <gord <at> gnu.ai.mit.edu>, 1996

Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ~> g++ --version
g++ (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ~>

How can it be solved? It seems to be a bug in libtool, right?
Can it be a problem with ordering of lib flags in libtool?

-- 
S pozdravem / Best regards

Petr Hracek

Red Hat Czech s.r.o.
BaseOS Core Services Brno

Email:phracek <at> redhat.com
Web:www.cz.redhat.com





This bug report was last modified 6 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.