Boost logo

Boost Users :

Subject: [Boost-users] [thread] mingw32: multiple definition of __tls_used
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2010-06-11 07:56:14


I have some troubles with mingw32 (compiling from cygwin with g++ 3.4.4):

The code below fails at link with following error message:
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/libmingw32.a(tlssup.o):tlssup.c:(.tls+0x0):
multiple definition of `__tls_used'
/cygdrive/d/Softs/1.7/mgw-release/boost/lib/libboost_thread_win32.a(tss_pe.o):tss_pe.cpp:(.rdata$T+0x0):
first defined here
collect2: ld returned 1 exit status

#include <boost/thread/tss.hpp>
int main() {
   boost::thread_specific_ptr<int> tsp;
   return 0;
}

Compiling command was:
$ g++-3 -o toto -O3 -DNDEBUG -mno-cygwin -mthreads -DBOOST_WINDOWS_API
-I/cygdrive/d/Softs/1.7/mgw-release/boost/include toto.cc
-L/cygdrive/d/Softs/1.7/mgw-release/boost/lib -lboost_thread_win32

Recently, mingw32 runtime was updated for cygwin with the following message:

> Implement TLS Callback.
>
> * tlsmcrt.c: New file.
> * tlsmthread.c: Ditto.
> * tlssup.c: Ditto.
> * tlsthrd.c: Ditto.
> * Makefile.in: Include new files.
> * crt1.c: Implement TLS Callback.
> * dllcrt1.c: Ditto.
> * mthr_stub.c: Remove.

Any clue?

Frédéric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net