Boost C++ Libraries: Ticket #9161: two definitions of future_object_base in v1.53 and 1.54 https://svn.boost.org/trac10/ticket/9161 <p> Our testing with icpc on Linux found one strange issue related to “BOOST_THREAD_VERSION”. </p> <p> When building the boost thread library (libboost_thread.a), we found that “BOOST_THREAD_VERSION” is defined as “2”, but when the test case (i.e set_exception_at_thread_exit_pass.cpp) is built, the “BOOST_THREAD_VERSION” is “4”. So when “-ipo” Is used, icpc gives link errors because two definitions of the same class “struct future_object_base : enable_shared_from_this&lt;future_object_base&gt;” is used. </p> <p> But Gcc seems working fine with its whole program optimization. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9161 Trac 1.4.3 anonymous Wed, 25 Sep 2013 22:17:57 GMT <link>https://svn.boost.org/trac10/ticket/9161#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9161#comment:1</guid> <description> <p> Adding more detail: </p> <p> when “-ipo” Is used, icpc generates incorrect code because two definitions of the same class “struct future_object_base : enable_shared_from_this&lt;future_object_base&gt;” is used. At "-ipo", icpc treats those classes as two different classes. case1: ===== </p> <blockquote> <p> struct future_object_base : enable_shared_from_this&lt;future_object_base&gt; { </p> <blockquote> <p> … shared_ptr&lt;future_continuation_base&gt; continuation_ptr; </p> </blockquote> </blockquote> <p> case 2: </p> <h6 class="section" id="a"></h6> <p> struct future_object_base : enable_shared_from_this&lt;future_object_base&gt; </p> <blockquote> <p> { </p> <blockquote> <p> … </p> </blockquote> <p> shared_ptr&lt;void&gt; continuation_ptr; </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 26 Sep 2013 18:05:52 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/9161#comment:2 https://svn.boost.org/trac10/ticket/9161#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket viboes Thu, 26 Sep 2013 18:06:01 GMT owner, status changed https://svn.boost.org/trac10/ticket/9161#comment:3 https://svn.boost.org/trac10/ticket/9161#comment:3 <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">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Thu, 26 Sep 2013 18:08:17 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9161#comment:4 https://svn.boost.org/trac10/ticket/9161#comment:4 <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">wontfix</span> </li> </ul> <p> I have no way to solve this issue. </p> <p> If you want to use BOOST_THREAD_VERSION 4 I suspect that you will need to build Boost with this define. </p> Ticket John Maddock Fri, 27 Sep 2013 08:43:14 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/9161#comment:5 https://svn.boost.org/trac10/ticket/9161#comment:5 <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">wontfix</span> </li> </ul> <p> As the person who suggested Jennifer file a bug report here I feel I should try and clarify the issue (Jennifer works for Intel: her interest is in testing their compiler against Boost, but of course this uncovers bugs in Boost as well as their compiler). </p> <p> 1) In the headers I see things like: </p> <pre class="wiki">#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION typedef shared_ptr&lt;shared_state_base&gt; continuation_ptr_type; #else // This type shouldn't be included, but is included to maintain the same layout. typedef shared_ptr&lt;void&gt; continuation_ptr_type; #endif </pre><p> So it appears that the intention is that the library should be binary compatible regards of the setting of BOOST_THREAD_VERSION? And yet that's clearly not the case - at least in the presence of IPO. At the very least this needs clearly documenting. </p> <p> 2) There are many tests which explicitly test version 3 or 4 features, but which still try and link against a library built with version 2. Again this won't work in the presence of IPO, and prevents the running of tests with IPO enabled (which is a good thing to test BTW). So IMO the Jamfile is broken - you should really build 3 versions of libboost_thread (for versions 2, 3 and 4) and link against the right one in each test. Clearly that's going to be tedious to fix, but I don't see how the current situation can be correct either (So it might actually be better to fix 1). </p> <p> Let me know if you need someone to run the tests with Intel C++. </p> Ticket viboes Fri, 27 Sep 2013 17:22:40 GMT <link>https://svn.boost.org/trac10/ticket/9161#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9161#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9161#comment:5" title="Comment 5">johnmaddock</a>: </p> <blockquote class="citation"> <p> As the person who suggested Jennifer file a bug report here I feel I should try and clarify the issue (Jennifer works for Intel: her interest is in testing their compiler against Boost, but of course this uncovers bugs in Boost as well as their compiler). </p> </blockquote> <p> </p> <blockquote class="citation"> <p> 1) In the headers I see things like: </p> <pre class="wiki">#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION typedef shared_ptr&lt;shared_state_base&gt; continuation_ptr_type; #else // This type shouldn't be included, but is included to maintain the same layout. typedef shared_ptr&lt;void&gt; continuation_ptr_type; #endif </pre><p> So it appears that the intention is that the library should be binary compatible regards of the setting of BOOST_THREAD_VERSION? And yet that's clearly not the case - at least in the presence of IPO. At the very least this needs clearly documenting. </p> </blockquote> <p> I don't know what IPO is, but yes the intention was to have the same layout. </p> <blockquote class="citation"> <p> 2) There are many tests which explicitly test version 3 or 4 features, but which still try and link against a library built with version 2. Again this won't work in the presence of IPO, and prevents the running of tests with IPO enabled (which is a good thing to test BTW). So IMO the Jamfile is broken - you should really build 3 versions of libboost_thread (for versions 2, 3 and 4) and link against the right one in each test. Clearly that's going to be tedious to fix, but I don't see how the current situation can be correct either (So it might actually be better to fix 1). </p> <p> Let me know if you need someone to run the tests with Intel C++. </p> </blockquote> <p> Could you replace </p> <pre class="wiki">#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION typedef shared_ptr&lt;shared_state_base&gt; continuation_ptr_type; #else // This type shouldn't be included, but is included to maintain the same layout. typedef shared_ptr&lt;void&gt; continuation_ptr_type; #endif </pre><p> by </p> <pre class="wiki"> typedef shared_ptr&lt;shared_state_base&gt; continuation_ptr_type; </pre><p> to see if just this fix the issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 04 Oct 2013 20:08:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9161#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9161#comment:7</guid> <description> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/86162" title="Thread: try to fix issue with double definition of shared_state_base.">[86162]</a>. </p> </description> <category>Ticket</category> </item> <item> <author>Jennifer.L.Jiang@…</author> <pubDate>Mon, 07 Oct 2013 04:14:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9161#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9161#comment:8</guid> <description> <p> the above suggested work-around in John's 2) worked for us. </p> <p> Jennifer </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 07 Oct 2013 05:17:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9161#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9161#comment:9</guid> <description> <p> Do you need this in release 1.55 or it is enough on trunk? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 08 Oct 2013 17:10:26 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/9161#comment:10 https://svn.boost.org/trac10/ticket/9161#comment:10 <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> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/86202" title="Thread: fix some issues with double definition of shared_state_base ...">[86202]</a>. </p> Ticket