Boost C++ Libraries: Ticket #8458: -DBOOST_THREAD_DONT_USE_CHRONO in thread.obj.rsp but not explicitly set https://svn.boost.org/trac10/ticket/8458 <p> Wondering if anyone can reproduce this on Windows. In my setup I don't specify BOOST_THREAD_DONT_USE_CHRONO anywhere but it appears in the generated rsp files which are used to build boost. Unless I'm doing something wrong this would contradict the documentation at <a href="http://www.boost.org/doc/libs/1_53_0/doc/html/thread/build.html">http://www.boost.org/doc/libs/1_53_0/doc/html/thread/build.html</a> which states: </p> <p> "Boost.Thread uses by default Boost.Chrono for the time related functions and define BOOST_THREAD_USES_CHRONO if BOOST_THREAD_DONT_USE_CHRONO is not defined. The user should define BOOST_THREAD_DONT_USE_CHRONO for compilers that don't work well with Boost.Chrono." </p> <p> An unfortunate consequence is that boost::thread::try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp;) is marked with dllimport but is not actually exported by the boost thread dll. LNK2001 ensues! </p> <p> I attach a patch which seems to fix the problem for me. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8458 Trac 1.4.3 anonymous Thu, 18 Apr 2013 13:48:00 GMT attachment set https://svn.boost.org/trac10/ticket/8458 https://svn.boost.org/trac10/ticket/8458 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">thread_use_chrono.patch</span> </li> </ul> Ticket viboes Thu, 18 Apr 2013 21:47:15 GMT <link>https://svn.boost.org/trac10/ticket/8458#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:1</guid> <description> <p> Are you sure you are using 1.53? Where do you see that </p> <pre class="wiki">boost::thread::try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp;); </pre><p> </p> <p> is declared with dllimport? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 18 Apr 2013 21:47:26 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/8458#comment:2 https://svn.boost.org/trac10/ticket/8458#comment:2 <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 anonymous Thu, 18 Apr 2013 21:52:02 GMT <link>https://svn.boost.org/trac10/ticket/8458#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:1" title="Comment 1">viboes</a>: </p> <blockquote class="citation"> <p> Are you sure you are using 1.53? Where do you see that </p> <pre class="wiki">boost::thread::try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp;); </pre><p> </p> <p> is declared with dllimport? </p> </blockquote> <p> It's implicitly dllexport/dllimport because the whole class boost::thread is declared so via BOOST_THREAD_DECL. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 18 Apr 2013 22:07:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8458#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:3" title="Comment 3">anonymous</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:1" title="Comment 1">viboes</a>: </p> <blockquote class="citation"> <p> Are you sure you are using 1.53? Where do you see that </p> <pre class="wiki">boost::thread::try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp;); </pre><p> </p> <p> is declared with dllimport? </p> </blockquote> <p> It's implicitly dllexport/dllimport because the whole class boost::thread is declared so via BOOST_THREAD_DECL. </p> </blockquote> <p> Thanks for clarification. I don't know how to use msvc import/export correctly. Could I remove the BOOST_THREAD_DECL on the class thread declaration and add it to the functions that are really exported? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 24 Apr 2013 13:56:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8458#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:4" title="Comment 4">viboes</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:3" title="Comment 3">anonymous</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:1" title="Comment 1">viboes</a>: </p> <blockquote class="citation"> <p> Are you sure you are using 1.53? Where do you see that </p> <pre class="wiki">boost::thread::try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp;); </pre><p> </p> <p> is declared with dllimport? </p> </blockquote> <p> It's implicitly dllexport/dllimport because the whole class boost::thread is declared so via BOOST_THREAD_DECL. </p> </blockquote> <p> Thanks for clarification. I don't know how to use msvc import/export correctly. Could I remove the BOOST_THREAD_DECL on the class thread declaration and add it to the functions that are really exported? </p> </blockquote> <p> Yes I think that would work fine (untested). Thanks for taking a look at this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 24 Apr 2013 16:37:26 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/8458 https://svn.boost.org/trac10/ticket/8458 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">8458.patch</span> </li> </ul> <p> Please, could you check the attached patch? </p> Ticket anonymous Thu, 25 Apr 2013 09:16:39 GMT <link>https://svn.boost.org/trac10/ticket/8458#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:6</guid> <description> <p> Would you mind attaching a unified diff? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 27 Apr 2013 05:32:36 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/8458 https://svn.boost.org/trac10/ticket/8458 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">8458.2.patch</span> </li> </ul> <p> Replaced erroneus patch </p> Ticket viboes Sat, 27 Apr 2013 05:34:03 GMT <link>https://svn.boost.org/trac10/ticket/8458#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:6" title="Comment 6">anonymous</a>: </p> <blockquote class="citation"> <p> Would you mind attaching a unified diff? </p> </blockquote> <p> I did a svn st instead of a svn diff :( Please take a look at 8458.2.patch. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 01 May 2013 09:56:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8458#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:8</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:7" title="Comment 7">viboes</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:6" title="Comment 6">anonymous</a>: </p> <blockquote class="citation"> <p> Would you mind attaching a unified diff? </p> </blockquote> <p> I did a svn st instead of a svn diff :( Please take a look at 8458.2.patch. </p> </blockquote> <p> This doesn't build for me. I think you changed boost::this_thread::get_id() but you meant to change boost::thread::get_id(). Btw I'm not convinced you need the additional decoration in the cpp file: isn't it implied by what's in the header file? It's possible I'm misunderstanding something. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 04 Jun 2013 06:25:07 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/8458#comment:9 https://svn.boost.org/trac10/ticket/8458#comment:9 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> </ul> <p> After more deeper analysis I will not fix it, and Boost.Thread will need Boost.Chrono on Windows. I'll force it and documented the constraint. </p> Ticket anonymous Tue, 04 Jun 2013 10:59:33 GMT <link>https://svn.boost.org/trac10/ticket/8458#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:10</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:9" title="Comment 9">viboes</a>: </p> <blockquote class="citation"> <p> After more deeper analysis I will not fix it, and Boost.Thread will need Boost.Chrono on Windows. I'll force it and documented the constraint. </p> </blockquote> <p> OK great. I'll test any patch you post here. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 08 Jun 2013 13:41:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8458#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:11</guid> <description> <p> Could you tell me if the following works for you? </p> <pre class="wiki">svn diff libs/thread/build/Jamfile.v2 boost/thread/detail/config.hpp Index: libs/thread/build/Jamfile.v2 =================================================================== --- libs/thread/build/Jamfile.v2 (revision 84414) +++ libs/thread/build/Jamfile.v2 (working copy) @@ -263,8 +263,11 @@ result = &lt;build&gt;no ; } } + result += &lt;define&gt;BOOST_THREAD_DONT_USE_CHRONO ; + } else { + result += &lt;define&gt;BOOST_THREAD_USES_CHRONO ; + result += &lt;library&gt;/boost/chrono//boost_chrono ; } - result += &lt;define&gt;BOOST_THREAD_DONT_USE_CHRONO ; if &lt;toolset&gt;pgi in $(properties) || &lt;toolset&gt;vacpp in $(properties) { Index: boost/thread/detail/config.hpp =================================================================== --- boost/thread/detail/config.hpp (revision 84414) +++ boost/thread/detail/config.hpp (working copy) @@ -318,6 +318,11 @@ #define BOOST_THREAD_USES_DATETIME #endif +#if defined(BOOST_THREAD_PLATFORM_WIN32) &amp;&amp; defined BOOST_THREAD_DONT_USE_CHRONO +#undef BOOST_THREAD_DONT_USE_CHRONO +#define BOOST_THREAD_USES_CHRONO +#endif + // BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55 // BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55 #if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 09 Jun 2013 08:30:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8458#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:12</guid> <description> <p> Committed in trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/84709" title="Thread: force use of chrono on windows.">[84709]</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 10 Jun 2013 17:36:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8458#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:13</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8458#comment:11" title="Comment 11">viboes</a>: </p> <blockquote class="citation"> <p> Could you tell me if the following works for you? </p> <pre class="wiki">svn diff libs/thread/build/Jamfile.v2 boost/thread/detail/config.hpp Index: libs/thread/build/Jamfile.v2 =================================================================== --- libs/thread/build/Jamfile.v2 (revision 84414) +++ libs/thread/build/Jamfile.v2 (working copy) @@ -263,8 +263,11 @@ result = &lt;build&gt;no ; } } + result += &lt;define&gt;BOOST_THREAD_DONT_USE_CHRONO ; + } else { + result += &lt;define&gt;BOOST_THREAD_USES_CHRONO ; + result += &lt;library&gt;/boost/chrono//boost_chrono ; } - result += &lt;define&gt;BOOST_THREAD_DONT_USE_CHRONO ; if &lt;toolset&gt;pgi in $(properties) || &lt;toolset&gt;vacpp in $(properties) { Index: boost/thread/detail/config.hpp =================================================================== --- boost/thread/detail/config.hpp (revision 84414) +++ boost/thread/detail/config.hpp (working copy) @@ -318,6 +318,11 @@ #define BOOST_THREAD_USES_DATETIME #endif +#if defined(BOOST_THREAD_PLATFORM_WIN32) &amp;&amp; defined BOOST_THREAD_DONT_USE_CHRONO +#undef BOOST_THREAD_DONT_USE_CHRONO +#define BOOST_THREAD_USES_CHRONO +#endif + // BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55 // BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55 #if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 </pre></blockquote> <p> Yes it does. Thanks! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 12 Jun 2013 21:01:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8458#comment:14 https://svn.boost.org/trac10/ticket/8458#comment:14 <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/84750" title="Thread: merge fixes for #8422, #8458, #8674.">[84750]</a>. </p> Ticket viboes Sat, 15 Jun 2013 10:35:46 GMT <link>https://svn.boost.org/trac10/ticket/8458#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8458#comment:15</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84792" title="Thread: fix #8458 and update doc.">[84792]</a>) Thread: fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8458" title="#8458: Bugs: -DBOOST_THREAD_DONT_USE_CHRONO in thread.obj.rsp but not explicitly set (closed: fixed)">#8458</a> and update doc. </p> </description> <category>Ticket</category> </item> </channel> </rss>