Boost C++ Libraries: Ticket #4258: Linking with boost thread does not work on mingw/gcc 4.5 https://svn.boost.org/trac10/ticket/4258 <p> 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 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4258 Trac 1.4.3 Danil Ilinykh <woodroof@…> Wed, 26 May 2010 06:16:56 GMT <link>https://svn.boost.org/trac10/ticket/4258#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:1</guid> <description> <p> If I try dynamic linking, it works well, but I get error while executing application: The application failed to initialize properly (0xc0000005) </p> </description> <category>Ticket</category> </item> <item> <author>Danil Ilinykh <woodroof@…></author> <pubDate>Thu, 27 May 2010 07:05:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:2</guid> <description> <p> This bug is introduced by mingwrt-3.18-mingw32. With mingwrt-3.17-mingw32 all works fine. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sun, 06 Jun 2010 11:47:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:3</guid> <description> <p> Duplicated of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3847" title="#3847: Bugs: Unable to statically link thread lib on ia64. (closed: wontfix)">#3847</a>? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>aszarsha</dc:creator> <pubDate>Mon, 07 Jun 2010 06:50:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:4</guid> <description> <p> you have to add this definition to your code: extern "C" void tss_cleanup_implemented() { } </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 24 Aug 2010 06:57:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:5</guid> <description> <p> 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 </p> <p> #if !defined(<span class="underline">MINGW</span>) ... #endif </p> </description> <category>Ticket</category> </item> <item> <author>Danil Ilinykh <woodroof@…></author> <pubDate>Thu, 02 Sep 2010 07:20:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:6</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <author>tristen_e@…</author> <pubDate>Mon, 06 Sep 2010 12:55:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:7</guid> <description> <p> This is also an issue in 1.41 (and therefore most likely any version onwards.) </p> <p> 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. </p> <p> 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: </p> <pre class="wiki">extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata$T"))) = { (DWORD) &amp;__tls_start__, (DWORD) &amp;__tls_end__, (DWORD) &amp;__tls_index__, (DWORD) (&amp;__crt_xl_start__+1), (DWORD) 0, (DWORD) 0 }; </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Bryce Adelstein Lelbach</dc:creator> <pubDate>Thu, 21 Oct 2010 19:01:46 GMT</pubDate> <title>severity, milestone changed; cc set https://svn.boost.org/trac10/ticket/4258#comment:8 https://svn.boost.org/trac10/ticket/4258#comment:8 <ul> <li><strong>cc</strong> <span class="trac-author">Bryce Adelstein Lelbach</span> added </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Showstopper</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.43.0</span> → <span class="trac-field-new">Boost-1.45.0</span> </li> </ul> <p> Replying to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4632" title="#4632: Bugs: [mingw] multiple definition of _tls_used. (closed: duplicate)">pluto@…</a>: </p> <blockquote class="citation"> <p> hi,<br /> i'm trying to build my application for mingw <a class="ext-link" href="http://mingw-w64.sourceforge.net"><span class="icon">​</span>http://mingw-w64.sourceforge.net</a><br /> with recent gcc-4.5 cross-compiler but the linker reports an error: </p> <pre class="wiki">(...)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 here </pre><p> Kai Tietz (the mingw maintainer) tolds me that boost needs correction in this area.<br /> here's the link to mingw implementation: </p> <p> <a class="ext-link" href="http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/branches/releases/v1.0/mingw-w64-crt/crt/tlssup.c?revision=HEAD&amp;view=markup"><span class="icon">​</span>tlssup.c</a> </p> </blockquote> <p> The above is from a from duplicate ticket; information may be relevant </p> <p> This is not the same as <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3847" title="#3847: Bugs: Unable to statically link thread lib on ia64. (closed: wontfix)">#3847</a>; that ticket claims that this occurs on a broader set of compilers. </p> Ticket Anthony Williams Fri, 22 Oct 2010 08:58:41 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4258#comment:9 https://svn.boost.org/trac10/ticket/4258#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed on trunk, revision 66140 </p> Ticket Jim Bell <jim@…> Sat, 14 May 2011 00:10:59 GMT <link>https://svn.boost.org/trac10/ticket/4258#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:10</guid> <description> <p> Could someone shepherd this to the release branch? Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 11 Dec 2011 11:22:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:11</guid> <description> <p> It seems this has been merged in <a class="missing ticket">#72431</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 05 Jan 2012 15:37:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4258#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4258#comment:12</guid> <description> <p> Still doesn't work for me :-( </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 10 Apr 2012 09:54:19 GMT</pubDate> <title>status, version, milestone changed; resolution deleted https://svn.boost.org/trac10/ticket/4258#comment:13 https://svn.boost.org/trac10/ticket/4258#comment:13 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.44.0</span> → <span class="trac-field-new">Boost 1.49.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.45.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> boost 1.49 have this: </p> <pre class="wiki">#if defined(__MINGW64__) || (__MINGW32_MAJOR_VERSION &gt;3) || \ ((__MINGW32_MAJOR_VERSION==3) &amp;&amp; (__MINGW32_MINOR_VERSION&gt;=18)) </pre><p> but mingw64 doesn't define </p> <pre class="wiki">__MINGW64__ </pre><blockquote> <p> when compiling x86 target. I've changed it to: </p> </blockquote> <pre class="wiki">#if defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION &gt;3) || \ ((__MINGW32_MAJOR_VERSION==3) &amp;&amp; (__MINGW32_MINOR_VERSION&gt;=18)) </pre><p> and it solve problem </p> Ticket viboes Thu, 21 Jun 2012 22:06:07 GMT owner, status changed https://svn.boost.org/trac10/ticket/4258#comment:14 https://svn.boost.org/trac10/ticket/4258#comment:14 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">new</span> </li> </ul> <p> Thanks for the info. I will apply it soon. </p> Ticket viboes Sat, 07 Jul 2012 15:13:50 GMT status, milestone changed https://svn.boost.org/trac10/ticket/4258#comment:15 https://svn.boost.org/trac10/ticket/4258#comment:15 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> </ul> <p> Committed in trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/79334" title="Thread: Added __MINGW64_VERSION_MAJOR when __MINGW64__ is not defined">[79334]</a> </p> Ticket viboes Mon, 09 Jul 2012 21:12:40 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4258#comment:16 https://svn.boost.org/trac10/ticket/4258#comment:16 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/79373" title="Thread: merge from trunk">[79373]</a>. </p> Ticket