Opened 12 years ago
Closed 10 years ago
#4258 closed Bugs (fixed)
Linking with boost thread does not work on mingw/gcc 4.5
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.51.0 | Component: | thread |
Version: | Boost 1.49.0 | Severity: | Showstopper |
Keywords: | Cc: | Bryce Adelstein Lelbach |
Description
Errors: c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libmingw32.a(tlssup.o):tlssup.c:(.tls+0x0): multiple definition of `_tls_used' C:\boost\mingw/Lib/libboost_thread.a(tss_pe.o):tss_pe.cpp:(.rdata$T+0x0): first defined here
Change History (16)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
This bug is introduced by mingwrt-3.18-mingw32. With mingwrt-3.17-mingw32 all works fine.
comment:4 by , 12 years ago
you have to add this definition to your code: extern "C" void tss_cleanup_implemented() { }
comment:5 by , 12 years ago
When adding some preprocessor checks in tss_pe.cpp that prevent the declaration _tls_used for MinGW, I've been able to fix this problem! All I did was to wrap it with
#if !defined(MINGW) ... #endif
follow-up: 7 comment:6 by , 12 years ago
Just comment out lines 57-65 in file /libs/thread/src/win32/tss_pe.cpp (this is for boost 1.44) and all works fine.
comment:7 by , 12 years ago
This is also an issue in 1.41 (and therefore most likely any version onwards.)
I've commented it out (lines 69-77 in v1.41) as suggested by Danil (thank you Sir!) Probably wrapping that bit of code with some kind of #if #endif would be the best solution as suggested by anonymous.
I've recompiled and everything seems OK - for those of you wondering what exactly what code it is that requires commenting in file /libs/thread/src/win32/tss_pe.cpp, it's this:
extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata$T"))) = { (DWORD) &__tls_start__, (DWORD) &__tls_end__, (DWORD) &__tls_index__, (DWORD) (&__crt_xl_start__+1), (DWORD) 0, (DWORD) 0 };
comment:8 by , 12 years ago
Cc: | added |
---|---|
Milestone: | Boost 1.43.0 → Boost-1.45.0 |
Severity: | Problem → Showstopper |
Replying to pluto@…:
hi,
i'm trying to build my application for mingw http://mingw-w64.sourceforge.net
with recent gcc-4.5 cross-compiler but the linker reports an error:(...)buildenv/windows/gcc-4.5/32/boost-1.44.0/lib/libboost_thread.a(tss_pe.o): tss_pe.cpp:(.rdata$T+0x0): multiple definition of `__tls_used' (...)/i686-pc-mingw32/lib/libmingw32.a(lib32_libmingw32_a-tlssup.o): (.tls+0x0): first defined hereKai Tietz (the mingw maintainer) tolds me that boost needs correction in this area.
here's the link to mingw implementation:
The above is from a from duplicate ticket; information may be relevant
This is not the same as #3847; that ticket claims that this occurs on a broader set of compilers.
comment:13 by , 11 years ago
Milestone: | Boost 1.45.0 → To Be Determined |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Version: | Boost 1.44.0 → Boost 1.49.0 |
boost 1.49 have this:
#if defined(__MINGW64__) || (__MINGW32_MAJOR_VERSION >3) || \ ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18))
but mingw64 doesn't define
__MINGW64__
when compiling x86 target. I've changed it to:
#if defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION >3) || \ ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18))
and it solve problem
comment:14 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
Thanks for the info. I will apply it soon.
comment:15 by , 10 years ago
Milestone: | To Be Determined → Boost 1.51.0 |
---|---|
Status: | new → assigned |
Committed in trunk [79334]
comment:16 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Committed revision [79373].
If I try dynamic linking, it works well, but I get error while executing application: The application failed to initialize properly (0xc0000005)