Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8458 closed Bugs (fixed)

-DBOOST_THREAD_DONT_USE_CHRONO in thread.obj.rsp but not explicitly set

Reported by: lukeocamden@… Owned by: viboes
Milestone: Boost 1.54.0 Component: thread
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

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 http://www.boost.org/doc/libs/1_53_0/doc/html/thread/build.html which states:

"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."

An unfortunate consequence is that boost::thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>&) is marked with dllimport but is not actually exported by the boost thread dll. LNK2001 ensues!

I attach a patch which seems to fix the problem for me.

Attachments (3)

thread_use_chrono.patch (274 bytes) - added by anonymous 4 years ago.
8458.patch (161 bytes) - added by viboes 4 years ago.
Please, could you check the attached patch?
8458.2.patch (7.6 KB) - added by viboes 4 years ago.
Replaced erroneus patch

Download all attachments as: .zip

Change History (18)

Changed 4 years ago by anonymous

Attachment: thread_use_chrono.patch added

comment:1 Changed 4 years ago by viboes

Are you sure you are using 1.53? Where do you see that

boost::thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>&);

is declared with dllimport?

comment:2 Changed 4 years ago by viboes

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:3 in reply to:  1 ; Changed 4 years ago by anonymous

Replying to viboes:

Are you sure you are using 1.53? Where do you see that

boost::thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>&);

is declared with dllimport?

It's implicitly dllexport/dllimport because the whole class boost::thread is declared so via BOOST_THREAD_DECL.

comment:4 in reply to:  3 ; Changed 4 years ago by viboes

Replying to anonymous:

Replying to viboes:

Are you sure you are using 1.53? Where do you see that

boost::thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>&);

is declared with dllimport?

It's implicitly dllexport/dllimport because the whole class boost::thread is declared so via BOOST_THREAD_DECL.

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?

comment:5 in reply to:  4 Changed 4 years ago by anonymous

Replying to viboes:

Replying to anonymous:

Replying to viboes:

Are you sure you are using 1.53? Where do you see that

boost::thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>&);

is declared with dllimport?

It's implicitly dllexport/dllimport because the whole class boost::thread is declared so via BOOST_THREAD_DECL.

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?

Yes I think that would work fine (untested). Thanks for taking a look at this.

Changed 4 years ago by viboes

Attachment: 8458.patch added

Please, could you check the attached patch?

comment:6 Changed 4 years ago by anonymous

Would you mind attaching a unified diff?

Changed 4 years ago by viboes

Attachment: 8458.2.patch added

Replaced erroneus patch

comment:7 in reply to:  6 ; Changed 4 years ago by viboes

Replying to anonymous:

Would you mind attaching a unified diff?

I did a svn st instead of a svn diff :( Please take a look at 8458.2.patch.

comment:8 in reply to:  7 Changed 4 years ago by anonymous

Replying to viboes:

Replying to anonymous:

Would you mind attaching a unified diff?

I did a svn st instead of a svn diff :( Please take a look at 8458.2.patch.

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.

comment:9 Changed 4 years ago by viboes

Milestone: To Be DeterminedBoost 1.54.0

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.

comment:10 in reply to:  9 Changed 4 years ago by anonymous

Replying to viboes:

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.

OK great. I'll test any patch you post here.

comment:11 Changed 4 years ago by viboes

Could you tell me if the following works for you?

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 = <build>no ;
             }
         }
+        result += <define>BOOST_THREAD_DONT_USE_CHRONO ;
+    } else {
+        result += <define>BOOST_THREAD_USES_CHRONO ;
+        result += <library>/boost/chrono//boost_chrono ;
     }
-    result += <define>BOOST_THREAD_DONT_USE_CHRONO ;
 
     if <toolset>pgi in $(properties)  || <toolset>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) && 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

comment:12 Changed 4 years ago by viboes

Committed in trunk [84709]

comment:13 in reply to:  11 Changed 4 years ago by anonymous

Replying to viboes:

Could you tell me if the following works for you?

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 = <build>no ;
             }
         }
+        result += <define>BOOST_THREAD_DONT_USE_CHRONO ;
+    } else {
+        result += <define>BOOST_THREAD_USES_CHRONO ;
+        result += <library>/boost/chrono//boost_chrono ;
     }
-    result += <define>BOOST_THREAD_DONT_USE_CHRONO ;
 
     if <toolset>pgi in $(properties)  || <toolset>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) && 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

Yes it does. Thanks!

comment:14 Changed 4 years ago by viboes

Resolution: fixed
Status: assignedclosed

Committed revision [84750].

comment:15 Changed 4 years ago by viboes

(In [84792]) Thread: fix #8458 and update doc.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.