-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BOOST_THREAD_USES_CHRONO not consistent on build and use #304
Comments
Or, maybe the best way to solve this is to just have Thread always depend on Chrono, even on Pthread platforms. |
I don't remember why it is different for pthreads and windows.
or
I don't see what a user wanting the opposite can do. |
The Jamfile define is only applied when the library is built; but once it's built, packaged, then installed with This happens to work fine only because all uses of We could leave this as is, but Linux CMake users will have to link to Boost::chrono by hand in addition to Boost::thread. Or, we could make BOOST_THREAD_USES_CHRONO default on Linux as well, so that Jamfile and config.hpp agree. |
@viboes would it be an option to link Chrono by default in case of pthread? This problem is namely causing some issues when we were are trying to utilise the produced BoostConfig.cmake file. |
As reported in boostorg/boost_install#27, the following program:
compiles on Linux but doesn't link without specifying
-lboost_chrono
, even though the Boost.Thread build/Jamfile doesn't specify Chrono as a dependency on Pthread platforms. The reason is that the Jamfile definesBOOST_THREAD_DONT_USE_CHRONO
on Pthread platforms when Boost.Thread is built. However, when Boost.Thread is used by user code,BOOST_THREAD_DONT_USE_CHRONO
is not defined and https://github.com/boostorg/thread/blob/develop/include/boost/thread/detail/config.hpp#L143 definesBOOST_THREAD_USES_CHRONO
. This enables thewait_for
overload and allows the code above to compile, even though the compiled library wasn't built withBOOST_THREAD_USES_CHRONO
.I'm not sure whether this behavior can be considered correct. One may argue that
BOOST_THREAD_USES_CHRONO
should not be defined on Pthread platforms by default, to match the settings with which the library is built.The text was updated successfully, but these errors were encountered: