Skip to content
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

fix for boost::thread >1.54 #45

Open
coldtobi opened this issue Sep 1, 2013 · 0 comments
Open

fix for boost::thread >1.54 #45

coldtobi opened this issue Sep 1, 2013 · 0 comments

Comments

@coldtobi
Copy link

coldtobi commented Sep 1, 2013

Hallo,
boost::thread needs to link against boost::atomic since 1.54.
The attached patch (should) fix this.

Thanks!

diff --git a/m4/boost.m4 b/m4/boost.m4
index c8eb65a..0af5bbf 100644
--- a/m4/boost.m4
+++ b/m4/boost.m4
@@ -737,7 +737,15 @@ BOOST_DEFUN([Program_Options],
                 [boost::program_options::options_description d("test");])
 ])# BOOST_PROGRAM_OPTIONS
## 

+# BOOST_ATOMIC([PREFERRED-RT-OPT])
+# -----------------------------------------
+# Look for Boost.Atomic.  For the documentation of PREFERRED-RT-OPT,
+# see the documentation of BOOST_FIND_LIB above.
+BOOST_DEFUN([Atomic],
+[BOOST_FIND_LIB([atomic], [$1],
-                [boost/atomic.hpp],
- ```
             [boost::atomic<bool> done (false);])

+])# BOOST_ATOMIC

_BOOST_PYTHON_CONFIG(VARIABLE, FLAG)

------------------------------------

@@ -885,8 +893,13 @@ if test $boost_major_version -ge 149; then
BOOST_SYSTEM([$1])
fi # end of the Boost.System check.
m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
-LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
-LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
+# At least on some archs, link-time dependency from thread to atomic was added as of 1.54
+if test $boost_major_version -ge 154; then
+BOOST_ATOMIC([$1])
+fi # end of the Boost.Atomic check.
+m4_pattern_allow([^BOOST_ATOMIC_(LIBS|LDFLAGS)$])dnl
+LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_ATOMIC_LIBS $boost_cv_pthread_flag"
+LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_ATOMIC_LDFLAGS"

Yes, we need to put the -pthread thing in CPPFLAGS because with GCC3,

boost/thread.hpp will trigger a #error if -pthread isn't used:

boost/config/requires_threads.hpp:47:5: #error "Compiler threading support

@@ -910,8 +923,8 @@ case $host_os in
;;
esac

-BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
-BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
+BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $BOOST_ATOMIC_LIBS $boost_cv_pthread_flag"
+BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS $BOOST_ATOMIC_LDFLAGS"
BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
LIBS=$boost_threads_save_LIBS
LDFLAGS=$boost_threads_save_LDFLAGS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant