From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-04-02 10:52:20
On Wednesday 02 April 2008 13:50:42 Rob Desbois wrote:
> I've been trying to link against Boost libraries 1.35.0 built with
> CodeSourcery's ARM/GNU toolchain and have had no luck yet.
> My user-config.jam contained the line:
> using gcc :: arm-none-linux-gnueabi-gcc ;
> and I built the libraries with:
> bjam --with-regex --with-serialization --with-thread stage
> This worked fine, however when linking the test program from the
> 'Getting Started (Unix)' guide I get:
> $ arm-none-linux-gnueabi-g++ test-regex.cpp -I.
> /tmp/ccVow1Eq.o: In function `boost::detail::atomic_decrement(int*)':
> undefined reference to `__sync_fetch_and_add_4'
> collect2: ld returned 1 exit status
> As far as I could ascertain this has something to do with compiling
> for the incorrect architecture/cpu.
I've just spoken with an ARM expert here at CodeSourcery, who tells me that
the atomic builtins, including __sync_fetch_and_add, are not supported
by GCC on ARM.
What happens is that boost/detail/sp_counted_base.hpp has this code:
#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
# include <boost/detail/sp_counted_base_sync.hpp>
and sp_counted_base_sync.hpp has this:
inline void atomic_increment( sp_int32_t * pw )
__sync_fetch_and_add( pw, 1 );
and while this apparent compiles, it does not work. I suggest you report this
problem on the C++ Boost developers mailing list -- I think the #elif condition
need to explicitly check for ARM.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk