#8458 closed Bugs (fixed)
-DBOOST_THREAD_DONT_USE_CHRONO in thread.obj.rsp but not explicitly set
Reported by: | 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)
Change History (18)
by , 10 years ago
Attachment: | thread_use_chrono.patch added |
---|
follow-up: 3 comment:1 by , 10 years ago
comment:2 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 4 comment:3 by , 10 years ago
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.
follow-up: 5 comment:4 by , 10 years ago
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 by , 9 years ago
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.
follow-up: 8 comment:7 by , 9 years ago
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 by , 9 years ago
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.
follow-up: 10 comment:9 by , 9 years ago
Milestone: | To Be Determined → Boost 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 by , 9 years ago
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.
follow-up: 13 comment:11 by , 9 years ago
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:13 by , 9 years ago
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 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Committed revision [84750].
Are you sure you are using 1.53? Where do you see that
is declared with dllimport?