Boost C++ Libraries: Ticket #6165: BOOST_ENABLE_THREADS/BOOST_DISABLE_THREADS wrongly configured on GCC 4.7 https://svn.boost.org/trac10/ticket/6165 <p> I find that Boost.Thread and other components in Boost that depend on thread support does not work on recent weekly snapshots of GCC trunk (GCC 4.7.0 experimental) on Ubuntu 10.04.3 LTS 64 bit because BOOST_ENABLE_THREADS is not defined on my environment and BOOST_DISABLE_THREADS is. </p> <p> The origin of this failure could be due to the change of macro definitions in GCC trunk. Now, GCC 4.7 (with -pthread option, of course) defines not the macro _GLIBCXX_HAVE_GTHR_DEFAULT but another macro _GLIBCXX_HAS_GTHREADS. Thus, BOOST_ENABLE_THREADS and BOOST_DISABLE_THREADS are wrongly configured in boost/config/stdlib/libstdcpp3.hpp. </p> <p> The attached patch seems to work for me, but I'm not sure how to detect thread support on GCC/libstdc++ correctly... </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6165 Trac 1.4.3 Ai Azuma <ai.azuma@…> Wed, 23 Nov 2011 08:39:06 GMT attachment set https://svn.boost.org/trac10/ticket/6165 https://svn.boost.org/trac10/ticket/6165 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">libstdcpp3.hpp.patch</span> </li> </ul> Ticket John Maddock Sat, 24 Dec 2011 16:19:44 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6165#comment:1 https://svn.boost.org/trac10/ticket/6165#comment:1 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/76133" title="Fix threading detection in GCC-4.7 experimental. Fixes #6165.">[76133]</a>) Fix threading detection in GCC-4.7 experimental. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6165" title="#6165: Bugs: BOOST_ENABLE_THREADS/BOOST_DISABLE_THREADS wrongly configured on GCC 4.7 (closed: fixed)">#6165</a>. </p> Ticket bkoz@… Tue, 10 Jan 2012 00:20:34 GMT <link>https://svn.boost.org/trac10/ticket/6165#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:2</guid> <description> <p> For 4.7, this is </p> <p> # if defined(_GLIBCXX_HAS_GTHREADS) </p> <p> For 4.6 and others, this should be </p> <p> # if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ </p> <blockquote> <table class="wiki"> <tr><td> defined(_GLIBCXX<span class="underline">PTHREADS) </span></td></tr></table> </blockquote> </description> <category>Ticket</category> </item> <item> <author>t.sailer@…</author> <pubDate>Sat, 14 Jan 2012 19:34:37 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/6165 https://svn.boost.org/trac10/ticket/6165 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-1.48.0-gcc47-winthreads.patch</span> </li> </ul> <p> Threading Detection fix for gcc 4.7/mingw32 target </p> Ticket t.sailer@… Sat, 14 Jan 2012 19:38:34 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/6165#comment:3 https://svn.boost.org/trac10/ticket/6165#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> The threading detection doesn't yet work for gcc 4.7 with the mingw32 target. </p> <p> mingw32 gcc defines (for some time already) <span class="underline">GLIBCXX</span>. Up to 4.6, it used to define _GLIBCXX_HAVE_GTHR_DEFAULT as well, that's why it worked up to 4.6. </p> <p> Now 4.7 no longer defines _GLIBCXX_HAVE_GTHR_DEFAULT, which prevents threading from compiling. </p> Ticket raptorfactor@… Mon, 16 Jan 2012 04:11:11 GMT <link>https://svn.boost.org/trac10/ticket/6165#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:4</guid> <description> <p> The Fedora project is using the following workaround/fix: </p> <p> <a class="ext-link" href="http://pkgs.fedoraproject.org/gitweb/?p=mingw32-boost.git;a=blob;f=boost-1.48.0-gcc47-winthreads.patch"><span class="icon">​</span>http://pkgs.fedoraproject.org/gitweb/?p=mingw32-boost.git;a=blob;f=boost-1.48.0-gcc47-winthreads.patch</a> </p> </description> <category>Ticket</category> </item> <item> <author>raptorfactor@…</author> <pubDate>Mon, 16 Jan 2012 04:21:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:5</guid> <description> <p> Oops, I just noticed Thomas has already posted it. Durrr. Sorry for the noise. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 16 Jan 2012 09:41:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:6</guid> <description> <p> What does bits/c++config.h do to detect when it's being build with --enable-threads ? There must be some such macro even if it's name has changed? </p> <p> Thanks, John. </p> </description> <category>Ticket</category> </item> <item> <author>t.sailer@…</author> <pubDate>Mon, 16 Jan 2012 12:51:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:7</guid> <description> <p> Interestingly, I do not have bits/c++config.h in my mingw32 gcc installation. </p> <p> gcc defines _MT if -mthreads is given on the command line (and that is the only difference). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 17 Jan 2012 13:14:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:8</guid> <description> <blockquote class="citation"> <p> gcc defines _MT if -mthreads is given on the command line (and that is the only difference). </p> </blockquote> <p> I'm not convinced that's the right thing to check - ideally what we want to know is "what configure options was libstdc++ compiled with?", and then set BOOST_HAS_THREADS uniformly based on that. </p> <p> Can someone please grep the headers for _GLIBCXX_HAS_GTHREADS: there should be a preprocessor based switch statement somewhere that selects which threading behaviour to use, and that's what we need to hook into. </p> <p> Thanks, John. </p> </description> <category>Ticket</category> </item> <item> <author>t.sailer@…</author> <pubDate>Tue, 17 Jan 2012 13:21:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:9</guid> <description> <p> $ find /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include /usr/i686-pc-mingw32/sys-root/mingw/include/ |xargs grep _GLIBCXX_HAS_GTHREADS /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/i686-pc-mingw32/bits/c++config.h:/* #undef _GLIBCXX_HAS_GTHREADS */ /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/thread:#if defined(_GLIBCXX_HAS_GTHREADS) &amp;&amp; defined(_GLIBCXX_USE_C99_STDINT_TR1) /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/thread:#endif <em> _GLIBCXX_HAS_GTHREADS &amp;&amp; _GLIBCXX_USE_C99_STDINT_TR1 /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/mutex:#if defined(_GLIBCXX_HAS_GTHREADS) &amp;&amp; defined(_GLIBCXX_USE_C99_STDINT_TR1) /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/mutex:#endif </em> _GLIBCXX_HAS_GTHREADS &amp;&amp; _GLIBCXX_USE_C99_STDINT_TR1 /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/condition_variable:#if defined(_GLIBCXX_HAS_GTHREADS) &amp;&amp; defined(_GLIBCXX_USE_C99_STDINT_TR1) /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/condition_variable:#endif <em> _GLIBCXX_HAS_GTHREADS &amp;&amp; _GLIBCXX_USE_C99_STDINT_TR1 /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/future:#if defined(_GLIBCXX_HAS_GTHREADS) &amp;&amp; defined(_GLIBCXX_USE_C99_STDINT_TR1) \ /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/future:#endif </em> _GLIBCXX_HAS_GTHREADS &amp;&amp; _GLIBCXX_USE_C99_STDINT_TR1 </p> <p> I can't find any definition. </p> </description> <category>Ticket</category> </item> <item> <author>t.sailer@…</author> <pubDate>Tue, 17 Jan 2012 13:28:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:10</guid> <description> <p> /usr/lib64/gcc/i686-pc-mingw32/4.7.0/include/c++/i686-pc-mingw32/bits/c++config.h has: </p> <p> /* Define if gthreads library is available. */ /* #undef _GLIBCXX_HAS_GTHREADS */ </p> <p> /* Define if pthreads_num_processors_np is available in &lt;pthread.h&gt;. */ /* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ </p> <p> /* Define to 1 if mutex_timedlock is available. */ #define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 </p> <p> I can't find anything else thread-related in there... </p> <p> Is it even possible to not have threading on Win32? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 20 Jan 2012 17:36:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6165#comment:11 https://svn.boost.org/trac10/ticket/6165#comment:11 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/76594" title="Enable thread support unconditionally on Win32 - it's not clear that ...">[76594]</a>) Enable thread support unconditionally on Win32 - it's not clear that this is the right thing to do, but it does seem to be needed for gcc-4.7 on Mingw and Cygwin. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6165" title="#6165: Bugs: BOOST_ENABLE_THREADS/BOOST_DISABLE_THREADS wrongly configured on GCC 4.7 (closed: fixed)">#6165</a>. </p> Ticket pwouters@… Mon, 23 Jul 2012 21:41:56 GMT <link>https://svn.boost.org/trac10/ticket/6165#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:12</guid> <description> <p> It seems to still be broken on fedora with boost-1.48.0-13 </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 24 Jul 2012 08:05:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6165#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6165#comment:13</guid> <description> <p> The patch was first released in 1.49.0. </p> </description> <category>Ticket</category> </item> </channel> </rss>