Opened 12 years ago
Last modified 12 years ago
#4376 new Bugs
Compilation failure on Solaris 5.9, 5.10, because of non existent membar_producer(membar_consumer)
Reported by: | Kozlov Taras | Owned by: | chris_kohlhoff |
---|---|---|---|
Milestone: | Boost 1.44.0 | Component: | asio |
Version: | Boost 1.43.0 | Severity: | Problem |
Keywords: | Cc: |
Description
We have to compile our application for a large set of unixes, including solaris 5.9 and 5.10. After switching from 1.42 to 1.43 I have got the following compilation error:
/export/esuitebuild/boost_1_43_0/boost/asio/detail/solaris_fenced_block.hpp: In constructor 'boost::asio::detail::solaris_fe\ nced_block::solaris_fenced_block()': /export/esuitebuild/boost_1_43_0/boost/asio/detail/solaris_fenced_block.hpp:41: error: 'membar_consumer' was not declared in\ this scope /export/esuitebuild/boost_1_43_0/boost/asio/detail/solaris_fenced_block.hpp: In destructor 'boost::asio::detail::solaris_fen\ ced_block::~solaris_fenced_block()': /export/esuitebuild/boost_1_43_0/boost/asio/detail/solaris_fenced_block.hpp:47: error: 'membar_producer' was not declared in\ this scope
These functions doesn`t exists in atomic.h. I found them in sys/atomic.h, and they can be used only from kernel mode.
Is there any way to avoid membar_producer(membar_consumer) usage?
Change History (3)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
I ran into the same problem when compiling under Solaris 8 using gcc 4.2. To circumvent the issue, I modified asio/detail/fenced_block.hpp where it checks #if defined (sun). I changed it to be #if defined(sun) && !defined(GNUC). This bypasses sun's atomic operations (which aren't present prior to Solaris 10) in favor of gcc's built-in implementation.
My application compiles fine now, however, I still need to test it. Is there a reason this change would be unsafe?
comment:3 by , 12 years ago
BOOST_ASIO_DISABLE_FENCED_BLOCK works well. Thank you. But seems you forgot to add it to documentation. Cannot find it here http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/using.html
This is a Solaris 9 issue; the membar functions are available in userspace on Solaris 10. Since you have access to Solaris 9, can you please suggest an alternative approach for that target.