Opened 9 years ago
Last modified 9 years ago
#9322 new Bugs
spinlock_gcc_arm.hpp fails when building iOS arm64
Reported by: | Owned by: | Peter Dimov | |
---|---|---|---|
Milestone: | To Be Determined | Component: | smart_ptr |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I am using boost in my iOS and Android applications and building for arm64 in iOS fails in spinlock_gcc_arm because the the SWP instruction and LDREX are not part of the arm64 instruction set. I do not have enough knowledge about the ARM assembly instructions to implement a proper fix for this myself and was hopeful someone with more expertise could provide a fix for the next release (or a patch for the current, if possible).
Change History (11)
comment:1 by , 9 years ago
Component: | None → smart_ptr |
---|---|
Owner: | set to |
comment:2 by , 9 years ago
comment:6 by , 9 years ago
I've added the ability to direct shared_ptr
to use an std::atomic
implementation by using #define BOOST_SP_USE_STD_ATOMIC
. You can find the commit at https://github.com/boostorg/smart_ptr/commit/fed15ad8c50921cbfc0365156e4e4f4454dc1b91. Eventually, this implementation will be selected by default when std::atomic
is autodetected to be present and functional, but for now, you can apply this patch, define the macro and see if that helps.
comment:7 by , 9 years ago
Running clang Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) like this:
clang++ -fvisibility=hidden" "-fvisibility-inlines-hidden" "-DBOOST_SP_USE_STD_ATOMIC" "-std=c++11" "-stdlib=libc++"
I get the following error:
In file included from ./boost/shared_ptr.hpp:17: In file included from ./boost/smart_ptr/shared_ptr.hpp:34: ./boost/smart_ptr/detail/spinlock_pool.hpp:80:89: error: call to deleted constructor of 'std::atomic_flag' (aka 'std::__1::atomic_flag') BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, ^~~~~~~~~~~~~~~~~~~~~~~~~~ ./boost/smart_ptr/detail/spinlock_std_atomic.hpp:81:38: note: expanded from macro 'BOOST_DETAIL_SPINLOCK_INIT' #define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } ^~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/atomic:1510:26: note: expanded from macro 'ATOMIC_FLAG_INIT' #define ATOMIC_FLAG_INIT {false} ^~~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/atomic:1384:5: note: function has been explicitly marked deleted here atomic_flag(const atomic_flag&) = delete; ^
comment:8 by , 9 years ago
I get the same with clang 3.4 for Windows; looks like a clang bug, as MSVC and g++ have no problems with this code.
comment:11 by , 9 years ago
This patch:
https://github.com/boostorg/smart_ptr/commit/fbb851097fa800fa9f19d6936906af7777d90215
should take care of the issue.
What compiler are you using?