undefined references '__sync_fetch_and_add_4 ' for Boost_1_39_0 on Alpha platform

Hi,
I got an error when building OpenOffice.org on Alpha EV6 platform, the
error log is as following:
Compiling: comphelper/unxlngaxp.pro/misc/comphelp4gcc3_version.c
Making: comphelper.lib
Making: libcomphelp4gcc3.so
../unxlngaxp.pro/slo/enumberablemap.o: In function
'comphelper::EnumerableMap::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any
const&)': '__sync_fetch_and_add_4' undefined reference
./unxlngaxp.pro/slo/enumberablemap.o: In function
'comphelper::EnumerableMap::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any
const&)': '__sync_fetch_and_add_4'undefined reference
../unxlngaxp.pro/slo/enumberablemap.o: In function
'comphelper::EnumerableMap::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any
const&)': '__sync_fetch_and_add_4'undefined reference
../unxlngaxp.pro/slo/enumberablemap.o: In function
'comphelper::EnumerableMap::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any
const&)': '__sync_fetch_and_add_4'undefined reference
../unxlngaxp.pro/slo/enumberablemap.o: In function
'comphelper::EnumerableMap::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any
const&)': '__sync_fetch_and_add_4'undefined reference
../unxlngaxp.pro/slo/enumberablemap.o: more undefined references to
'__sync_fetch_and_add_4' follow
collect2: ld returned 1 exit status
dmake: Error code 1: while making '../unxlngaxp.pro/lib/libcomphelp4gcc3.so'
The

On Nov 23, 2010, at 6:07 AM, Yan Wu wrote:
Hi,
I got an error when building OpenOffice.org on Alpha EV6 platform, the error log is as following:
Compiling: comphelper/unxlngaxp.pro/misc/comphelp4gcc3_version.c Making: comphelper.lib Making: libcomphelp4gcc3.so ../unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4' undefined reference ./unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4'undefined reference ../unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4'undefined reference ../unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4'undefined reference ../unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4'undefined reference ../unxlngaxp.pro/slo/enumberablemap.o: more undefined references to '__sync_fetch_and_add_4' follow collect2: ld returned 1 exit status dmake: Error code 1: while making '../unxlngaxp.pro/lib/ libcomphelp4gcc3.so'
The
of Boost_1_39_0 is used here. Is this a bug on Boost_1_39_0 ? and is there already a fix for it? Best Regards, Yan
These functions are built-in functions provided by gcc to implement atomic operations. For some platforms, these intrinsics were not implemented.. You can either provide an implementation yourself, or use a newer version of gcc that implements them. KEVIN ARUNSKI

Kevin Arunski wrote:
On Nov 23, 2010, at 6:07 AM, Yan Wu wrote:
Hi,
I got an error when building OpenOffice.org on Alpha EV6 platform, the error log is as following:
Compiling: comphelper/unxlngaxp.pro/misc/comphelp4gcc3_version.c Making: comphelper.lib Making: libcomphelp4gcc3.so ../unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4' undefined reference ... These functions are built-in functions provided by gcc to implement atomic operations. For some platforms, these intrinsics were not implemented.. You can either provide an implementation yourself, or use a newer version of gcc that implements them.
Yes. To disable shared_ptr's use of these intrinsics, #define BOOST_SP_USE_PTHREADS.

On 11/23/10, Peter Dimov
Kevin Arunski wrote:
On Nov 23, 2010, at 6:07 AM, Yan Wu wrote:
Hi,
I got an error when building OpenOffice.org on Alpha EV6 platform, the error log is as following:
Compiling: comphelper/unxlngaxp.pro/misc/comphelp4gcc3_version.c Making: comphelper.lib Making: libcomphelp4gcc3.so ../unxlngaxp.pro/slo/enumberablemap.o: In function 'comphelper ::EnumerableMap ::initialize(com::sun::star::uno::Sequencecom::sun::star::uno::Any const&)': '__sync_fetch_and_add_4' undefined reference ... These functions are built-in functions provided by gcc to implement atomic operations. For some platforms, these intrinsics were not implemented.. You can either provide an implementation yourself, or use a newer version of gcc that implements them.
Yes. To disable shared_ptr's use of these intrinsics, #define BOOST_SP_USE_PTHREADS.
Thanks for your kindly replies. It's a little difficult to implement the atomic operations by myself;-) Where should the macro BOOST_SP_USE_PTHREADS be defined ? Which file in boost or the file in my comphelper.cxx? Regards, Yan

Where should the macro BOOST_SP_USE_PTHREADS be defined ? Which file in boost or the file in my comphelper.cxx?
You should define it globally, both in your project and in bjam line when you build boost.

Yan Wu wrote:
Yes. To disable shared_ptr's use of these intrinsics, #define BOOST_SP_USE_PTHREADS.
Thanks for your kindly replies. It's a little difficult to implement the atomic operations by myself;-) Where should the macro BOOST_SP_USE_PTHREADS be defined ? Which file in boost or the file in my comphelper.cxx?
You need to define it in each cpp/cxx file that uses shared_ptr. The safest way to do that is to define it globally for the project by, for example, adding -DBOOST_SP_USE_PTHREADS to the build flags.

On 11/24/10, Peter Dimov
Yan Wu wrote:
Yes. To disable shared_ptr's use of these intrinsics, #define BOOST_SP_USE_PTHREADS.
Thanks for your kindly replies. It's a little difficult to implement the atomic operations by myself;-) Where should the macro BOOST_SP_USE_PTHREADS be defined ? Which file in boost or the file in my comphelper.cxx?
You need to define it in each cpp/cxx file that uses shared_ptr. The safest way to do that is to define it globally for the project by, for example, adding -DBOOST_SP_USE_PTHREADS to the build flags.
I added -DBOOST_SP_USE_PTHREADS globally and the compiling passed successfully. Thanks very much for your help. Regards, Yan

I added -DBOOST_SP_USE_PTHREADS globally and the compiling passed successfully. Thanks very much for your help.
Note that if you use some other boost libs, which might use shared_ptr, you have to compile them with this flag as well.

On 11/24/10, Igor R
I added -DBOOST_SP_USE_PTHREADS globally and the compiling passed successfully. Thanks very much for your help.
Note that if you use some other boost libs, which might use shared_ptr, you have to compile them with this flag as well. Yes, it is necessary to check about this. Thank you.:-)
Regards, Yan
participants (4)
-
Igor R
-
Kevin Arunski
-
Peter Dimov
-
Yan Wu