Smaller testcase:

---- 8< Makefile ----
# $ make
# g++ -Wl,-no-add-needed -shared -o lpthread.so -lpthread
# g++ -Wl,-no-add-needed -o deb591405 deb591405.cpp lpthread.so 
# /usr/bin/ld: ,: invalid DSO for symbol `pthread_cancel@@GLIBC_2.0' definition
# /lib/libpthread.so.0: could not read symbols: Bad value
CXX     := g++
CXXLD   := $(CXX) -Wl,-no-add-needed
#CXXLD  := $(CXX)

deb591405: deb591405.cpp lpthread.so
        $(CXXLD) -o $@ $+ 

lpthread.so:
        $(CXXLD) -shared -o $@ -lpthread


---- 8< deb591405.cpp -----
/* c++-progs -> library -> pthread
 *
 * 1. library links to pthread explicitely
 * 2. c++-prog does not link to pthread
 *
 * 3. libstdc++ weakly pulls pthread_cancel, which confuses linker when
 *    building with -Wl,no-add-needed
 *
 * See http://bugs.debian.org/591405
 */

#include <string>
#include <iostream>
using namespace std;

int main()
{
    string msg = "I hope Debian bug #591405 has been fixed!\n";

    cout << msg;
    return 0;
}



-- 
To UNSUBSCRIBE, email to debian-gcc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100806151221.gb20...@roro3.zxlink

Reply via email to