This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15391] New: -pthread not implicitly generating -lpthread when linking shared object
- From: "John dot Bossom at cognos dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 May 2004 06:35:42 -0000
- Subject: [Bug c++/15391] New: -pthread not implicitly generating -lpthread when linking shared object
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Summary:
On System A, gcc is NOT implicitly generating a reference to -lpthread
when specifying -pthread when building a shared library.
On System B, gcc DOES implicitly generate a reference to -lpthread
when specifying -pthread when building a shared library.
Expected Results:
Specifying -pthread should generate link to -lpthread implicitly on
System A.
Details:
The following two blocks of output were generated using
"g++ -v -shared -pthread -o crap crap.cpp"
The first block was generated on System A:
IBM pSeries running Red Hat Enterprise Server 3.0 AS.
The second block was generated on System B:
HP Proliant ML 350 (i386) running Red Hat Enterprise Server 3.0 WS
Both are using the same version of gcc (i.e. that which is installed by
default with RHES 3.0, namely gcc 3.2.3.
===========================================================
System A:
===========================================================
vulcan 145% g++ -v -shared -pthread -o crap crap.cpp
Reading specs from /usr/lib/gcc-lib/ppc64-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-
checking --with-system-zlib --enable-__cxa_atexit --host=ppc64-redhat-linux --
build=ppc64-redhat-linux --target=ppc64-redhat-linux --with-cpu=default32
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-24)
/usr/lib/gcc-lib/ppc64-redhat-linux/3.2.3/cc1plus -v -D__GNUC__=3 -
D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -
D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -D_CALL_SYSV -D_BIG_ENDIAN -
D__BIG_ENDIAN__ -Amachine=bigendian -D_ARCH_PPC -DPPC -Dpowerpc -D__PPC__ -
D__ELF__ -D__powerpc__ -D__PPC -D__powerpc -Acpu=powerpc -Amachine=powerpc -
D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__WCHAR_TYPE__=long int -
D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -
Asystem=unix -Asystem=posix -D_REENTRANT crap.cpp -D__GNUG__=3 -D__DEPRECATED -
D__EXCEPTIONS -quiet -dumpbase crap.cpp -version -o /tmp/cc4u8hmR.s
GNU CPP version 3.2.3 20030502 (Red Hat Linux 3.2.3-24) (cpplib) (PowerPC64
GNU/Linux)
GNU C++ version 3.2.3 20030502 (Red Hat Linux 3.2.3-24) (ppc64-redhat-linux)
compiled by GNU C version 3.2.3 20030502 (Red Hat Linux 3.2.3-24).
ignoring nonexistent directory "/usr/ppc64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/3.2.3
/usr/include/c++/3.2.3/ppc64-redhat-linux
/usr/include/c++/3.2.3/backward
/usr/local/include
/usr/lib/gcc-lib/ppc64-redhat-linux/3.2.3/include
/usr/include
End of search list.
as -a32 -mppc -V -Qy -o /tmp/ccyUL2pG.o /tmp/cc4u8hmR.s
GNU assembler version 2.14.90.0.4 (ppc-redhat-linux) using BFD version
2.14.90.0.4 20030523
/usr/lib/gcc-lib/ppc64-redhat-linux/3.2.3/collect2 --eh-frame-hdr -V -Qy -
shared -m elf32ppclinux -o crap /usr/lib/gcc-lib/ppc64-redhat-
linux/3.2.3/../../../../lib/crti.o /usr/lib/gcc-lib/ppc64-redhat-
linux/3.2.3/crtbeginS.o -L/usr/lib/gcc-lib/ppc64-redhat-linux/3.2.3 -
L/usr/lib/gcc-lib/ppc64-redhat-linux/3.2.3/../../../../lib -L/usr/lib/gcc-
lib/ppc64-redhat-linux/3.2.3/../../.. -L/lib/../lib -
L/usr/lib/../lib /tmp/ccyUL2pG.o -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc-
lib/ppc64-redhat-linux/3.2.3/crtsavres.o /usr/lib/gcc-lib/ppc64-redhat-
linux/3.2.3/crtendS.o /usr/lib/gcc-lib/ppc64-redhat-
linux/3.2.3/../../../../lib/crtn.o
GNU ld version 2.14.90.0.4 20030523
Supported emulations:
elf32ppclinux
elf32ppc
elf32ppcsim
elf64ppc
===========================================================
System B:
===========================================================
drifter.cognos.com 55% g++ -v -shared -pthread -o crap crap.cpp
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-
checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-24)
/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/cc1plus -v -D__GNUC__=3 -
D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -D__ELF__ -
Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -
D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -
D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -
D__tune_i386__ -D_REENTRANT crap.cpp -D__GNUG__=3 -D__DEPRECATED -
D__EXCEPTIONS -quiet -dumpbase crap.cpp -version -o /tmp/ccfgMhMf.s
GNU CPP version 3.2.3 20030502 (Red Hat Linux 3.2.3-24) (cpplib) (i386
Linux/ELF)
GNU C++ version 3.2.3 20030502 (Red Hat Linux 3.2.3-24) (i386-redhat-linux)
compiled by GNU C version 3.2.3 20030502 (Red Hat Linux 3.2.3-24).
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/3.2.3
/usr/include/c++/3.2.3/i386-redhat-linux
/usr/include/c++/3.2.3/backward
/usr/local/include
/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include
/usr/include
End of search list.
as -V -Qy -o /tmp/ccgmVfZm.o /tmp/ccfgMhMf.s
GNU assembler version 2.14.90.0.4 (i386-redhat-linux) using BFD version
2.14.90.0.4 20030523
/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/collect2 --eh-frame-hdr -m elf_i386 -
shared -o crap /usr/lib/gcc-lib/i386-redhat-
linux/3.2.3/../../../crti.o /usr/lib/gcc-lib/i386-redhat-
linux/3.2.3/crtbeginS.o -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.3 -
L/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../.. /tmp/ccgmVfZm.o -lstdc++ -
lm -lgcc_s -lpthread -lc -lgcc_s /usr/lib/gcc-lib/i386-redhat-
linux/3.2.3/crtendS.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crtn.o
--
Summary: -pthread not implicitly generating -lpthread when
linking shared object
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: John dot Bossom at cognos dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15391