Skip to contentSkip to conversation

boost: Add patch to avoid undefined references to boost::atomic::lockpool::get_lock_for()

PATCH In review Phil Blundell 3 participants 4 messages Nov 14, 2013 – Nov 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 boost: Add patch to avoid undefined references to boost::atomic::lockpool::get_lock_for()

Boost::thread uses functions from boost::atomic but doesn't actually link with libboost_atomic. This works fine on platforms where BOOST_ATOMIC_FLAG_LOCK_FREE is true but will lead to undefined symbol references otherwise. Fix this by applying a patch from the upstream bug tracker to add the missing library linkage.

---
 meta/recipes-support/boost/boost_1.54.0.bb         |  1 +
 .../files/boost-1.54.0-thread-link_atomic.patch    | 59 ++++++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch
meta/recipes-support/boost/boost_1.54.0.bb +1 -0
index 3cf88fa..9e7a60a 100644
@@ -3,4 +3,5 @@ include boost.inc
 
 SRC_URI += "file://arm-intrinsics.patch \
             file://glibc.patch \
+            file://boost-1.54.0-thread-link_atomic.patch \
            "
meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.8.4.rc3
#1 lore raw
Quoted 5 lines · Phil Blundell

Boost::thread uses functions from boost::atomic but doesn't actually link with libboost_atomic. This works fine on platforms where BOOST_ATOMIC_FLAG_LOCK_FREE is true but will lead to undefined symbol references otherwise. Fix this by applying a patch from the upstream bug tracker to add the missing library linkage.

Is it fixed in 1.55? Then we might apply this to Dora and upgrade master to 1.55

Quoted 106 lines
Signed-off-by Phil Blundell <[email protected] <javascript:;>>
---
 meta/recipes-support/boost/boost_1.54.0.bb         |  1 +
 .../files/boost-1.54.0-thread-link_atomic.patch    | 59
++++++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644

meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch

(quoted diff) +0 -0

boost_1.54.0.bb
index 3cf88fa..9e7a60a 100644

meta/recipes-support/boost/boost_1.54.0.bb +1 -0
@@ -3,4 +3,5 @@ include boost.inc
 
 SRC_URI += "file://arm-intrinsics.patch \
             file://glibc.patch \
+            file://boost-1.54.0-thread-link_atomic.patch \
            "

diff --git a/meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch b/meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch new file mode 100644
index 0000000..d39d0a9
--- /dev/null
+++
b/meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch

meta/recipes-support/boost/boost_1.54.0.bb +9 -0
@@ -0,0 +1,59 @@
+Link boost_thread with boost_atomic to avoid undefined references to
+boost::atomic::detail::lock_pool::get_lock_for().
+
+From https://svn.boost.org/trac/boost/ticket/9041
+
+Phil Blundell <[email protected] <javascript:;>>
+Upstream-Status: Backport
+
+diff -Nurp

boost_1_54_0/libs/thread/build/has_atomic_flag_lockfree_test.cpp boost_1_54_0.pm/libs/thread/build/has_atomic_flag_lockfree_test.cpp +--- boost_1_54_0/libs/thread/build/has_atomic_flag_lockfree_test.cpp

1970-01-01 01:00:00.000000000 +0100

++++ boost_1_54_0.pm/libs/thread/build/has_atomic_flag_lockfree_test.cpp 2013-08-23 19:51:52.706329968 +0200
+@@ -0,0 +1,14 @@
++// Copyright (c) 2013, Petr Machata, Red Hat Inc.
++//
++// Use modification and distribution are subject to the boost Software ++// License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
++
++#include "../../../boost/atomic.hpp"
++#include "../../../boost/static_assert.hpp"
++
++int
++main(int argc, char *argv[])
++{
++ BOOST_STATIC_ASSERT(BOOST_ATOMIC_FLAG_LOCK_FREE);
++ return 0;
++}
+diff -Nurp boost_1_54_0/libs/thread/build/Jamfile.v2 boost_1_54_0.pm/libs/thread/build/Jamfile.v2
+--- boost_1_54_0/libs/thread/build/Jamfile.v2 2013-06-15 12:35:45.000000000 +0200
++++ boost_1_54_0.pm/libs/thread/build/Jamfile.v2 2013-08-23
19:52:30.018613408 +0200
+@@ -36,6 +36,7 @@ import os ;
+ import feature ;
+ import indirect ;
+ import path ;
++import configure ;

meta/recipes-support/boost/boost_1.54.0.bb +8 -0
+
+ project boost/thread
+     : source-location ../src
+@@ -140,6 +141,8 @@ local rule default_threadapi ( )
+ feature.feature threadapi : pthread win32 : propagated ;
+ feature.set-default threadapi : [ default_threadapi ] ;
+
++exe has_atomic_flag_lockfree :

../build/has_atomic_flag_lockfree_test.cpp ;
++
+ rule tag ( name : type ? : property-set )
+ {

meta/recipes-support/boost/boost_1.54.0.bb +14 -1
+     local result = $(name) ;
+@@ -248,6 +251,12 @@ rule requirements ( properties * )
+ {
+     local result ;
+
++    if ! [ configure.builds has_atomic_flag_lockfree
++         : $(properties) : "lockfree boost::atomic_flag" ]
++    {
++        result += <library>/boost/atomic//boost_atomic ;
++    }
++
+     if <threadapi>pthread in $(properties)
+     {
+         result += <define>BOOST_THREAD_POSIX ;
--

1.8.4.rc3

_______________________________________________
Openembedded-core mailing list [email protected] <javascript:;>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 14 lines · Khem Raj

On Thursday, November 14, 2013, Phil Blundell wrote:

Boost::thread uses functions from boost::atomic but doesn't actually
link with libboost_atomic. This works fine on platforms where BOOST_ATOMIC_FLAG_LOCK_FREE is true but will lead to undefined symbol references otherwise. Fix this by applying a patch from
the upstream bug tracker to add the missing library linkage.

Quoted 2 lines

Is it fixed in 1.55? Then we might apply this to Dora and upgrade master to 1.55

According to the 1.55 release notes, yes:

Thread:
New Features:

#8519 Synchro: Update class barrier with a completion function.
#8515 Async: Add shared_future::then.
#8519 Synchro: Update class barrier with a completion function
#8615 Async: Replace make_future/make_shared_future by make_ready_future.
#8627 Async: Add future<>::unwrap and unwrapping constructor.
#8677 Async: Add future<>::get_or.
#8678 Async: Add future<>::fallback_to. #8891 upgrade_to_unique_lock: missing mutex() function. #8955 Request for more efficient way to get exception_ptr from future.
Fixed Bugs:

#7461 detail::win32::ReleaseSemaphore may be called with count_to_release equal to 0
#8070 prefer GetTickCount64 over GetTickCount #8768 win32 condition_variable::wait_until infinite wait in rare cases.
#8817 Boost Thread Windows CE _createthreadex handling breaks mingw w64.
#8943 Failed to compile code using boost::call_once with Intel C++ Composer XE 2013 on Windows.
#8931 Typos in external_locking reference. #9029 Misprint in documentation.
#9037 gcc -Wshadow gives warnings in condition_variable{,_fwd}.hpp.
#9041 Boost.Thread DSO's may need to link with Boost.Atomic.
#9048 boost::scoped_thread useless ctor with variadic template arguments.
#9079 Condition variable will wait forever for some timepoint values (Win).

p.

#3 lore raw
In reply to Khem Raj
Quoted 9 lines · Khem Raj
Quoted 5 lines · Phil Blundell

Boost::thread uses functions from boost::atomic but doesn't actually link with libboost_atomic. This works fine on platforms where BOOST_ATOMIC_FLAG_LOCK_FREE is true but will lead to undefined symbol references otherwise. Fix this by applying a patch from the upstream bug tracker to add the missing library linkage.

Quoted 3 lines

Is it fixed in 1.55? Then we might apply this to Dora and upgrade master to 1.55

Hi Khem,

Thanks, I will try it in dora.

// Robert

Quoted 114 lines
Quoted 101 lines
Signed-off-by Phil Blundell <[email protected] <javascript:;>>
---
  meta/recipes-support/boost/boost_1.54.0.bb         |  1 +
  .../files/boost-1.54.0-thread-link_atomic.patch    | 59
++++++++++++++++++++++
  2 files changed, 60 insertions(+)

create mode 100644
meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch

(quoted diff) +0 -0

boost_1.54.0.bb
index 3cf88fa..9e7a60a 100644

meta/recipes-support/boost/boost_1.54.0.bb +1 -0
@@ -3,4 +3,5 @@ include boost.inc
 
  SRC_URI += "file://arm-intrinsics.patch \
              file://glibc.patch \
+            file://boost-1.54.0-thread-link_atomic.patch \
             "

diff --git a/meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch b/meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch new file mode 100644
index 0000000..d39d0a9
--- /dev/null
+++
b/meta/recipes-support/boost/files/boost-1.54.0-thread-link_atomic.patch

meta/recipes-support/boost/boost_1.54.0.bb +9 -0
@@ -0,0 +1,59 @@
+Link boost_thread with boost_atomic to avoid undefined references to
+boost::atomic::detail::lock_pool::get_lock_for().
+
+From https://svn.boost.org/trac/boost/ticket/9041
+
+Phil Blundell <[email protected] <javascript:;>>
+Upstream-Status: Backport
+
+diff -Nurp

boost_1_54_0/libs/thread/build/has_atomic_flag_lockfree_test.cpp boost_1_54_0.pm/libs/thread/build/has_atomic_flag_lockfree_test.cpp +--- boost_1_54_0/libs/thread/build/has_atomic_flag_lockfree_test.cpp

1970-01-01 01:00:00.000000000 +0100

++++ boost_1_54_0.pm/libs/thread/build/has_atomic_flag_lockfree_test.cpp 2013-08-23 19:51:52.706329968 +0200
+@@ -0,0 +1,14 @@
++// Copyright (c) 2013, Petr Machata, Red Hat Inc.
++//
++// Use modification and distribution are subject to the boost Software ++// License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
++
++#include "../../../boost/atomic.hpp"
++#include "../../../boost/static_assert.hpp"
++
++int
++main(int argc, char *argv[])
++{
++ BOOST_STATIC_ASSERT(BOOST_ATOMIC_FLAG_LOCK_FREE);
++ return 0;
++}
+diff -Nurp boost_1_54_0/libs/thread/build/Jamfile.v2 boost_1_54_0.pm/libs/thread/build/Jamfile.v2
+--- boost_1_54_0/libs/thread/build/Jamfile.v2 2013-06-15 12:35:45.000000000 +0200
++++ boost_1_54_0.pm/libs/thread/build/Jamfile.v2 2013-08-23
19:52:30.018613408 +0200
+@@ -36,6 +36,7 @@ import os ;
+ import feature ;
+ import indirect ;
+ import path ;
++import configure ;

meta/recipes-support/boost/boost_1.54.0.bb +8 -0
+
+ project boost/thread
+     : source-location ../src
+@@ -140,6 +141,8 @@ local rule default_threadapi ( )
+ feature.feature threadapi : pthread win32 : propagated ;
+ feature.set-default threadapi : [ default_threadapi ] ;
+
++exe has_atomic_flag_lockfree :

../build/has_atomic_flag_lockfree_test.cpp ;
++
+ rule tag ( name : type ? : property-set )
+ {

meta/recipes-support/boost/boost_1.54.0.bb +14 -1
+     local result = $(name) ;
+@@ -248,6 +251,12 @@ rule requirements ( properties * )
+ {
+     local result ;
+
++    if ! [ configure.builds has_atomic_flag_lockfree
++         : $(properties) : "lockfree boost::atomic_flag" ]
++    {
++        result += <library>/boost/atomic//boost_atomic ;
++    }
++
+     if <threadapi>pthread in $(properties)
+     {
+         result += <define>BOOST_THREAD_POSIX ;
--

1.8.4.rc3

Quoted 5 lines

_______________________________________________
Openembedded-core mailing list [email protected] <javascript:;>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core