Bug#760542: libc++-helpers: g++-libc++ script doesn't work with -pthread

Miles Bader miles at gnu.org
Fri Sep 5 05:00:09 UTC 2014


Package: libc++-helpers
Version: 3.5-1
Severity: normal

Dear Maintainer,


The g++-libc++ script generally seems to work, but using the -pthread
option results in link errors like:

   $ g++-libc++ -o conftest  -std=c++11 -Wall -Wextra -Winit-self -Wdouble-promotion -pedantic-errors -Wno-long-long -pthread conftest.cpp -lm
   /usr/bin/ld: /tmp/cckd9zJb.o: undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5'
   //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line

This is easy to fix, just by adding -lpthread as the gcc driver
normally does when given -pthread.  

The following replacement "g++-libc++" script works for me (and C++
threading etc works fine):

   #!/bin/sh

   cxx_libs="-lc++"
   c_libs="-lc -lgcc_s"
   pthread_libs="-lpthread $c_libs"

   libs="$cxx_libs $c_libs"

   for i; do
     if test x"$i" = x"-pthread"; then
       libs="$libs $pthread_libs"
       break
     fi
   done

   gcc -std=c++0x -nodefaultlibs $libs -isystem/usr/include/c++/v1 "$@"


Thanks,

-miles


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- no debconf information



More information about the Pkg-llvm-team mailing list