[pkg-boost-devel] Bug#485434: undefined reference to __sync_fetch_and_add_4

Kai Fischer fischer at vrmagic.com
Mon Jun 9 14:07:30 UTC 2008


Package: libboost1.35-dev
Version: 1.35.0-5
Architecture: armel (most probably also on arm)

During linking the following error is thrown: undefined reference to
`__sync_fetch_and_add_4'

Because of the following code in boost/detail/sp_counted_base.hpp:

#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) 
# include <boost/detail/sp_counted_base_sync.hpp> 

boost/detail/sp_counted_base_sync.hpp: 
inline void atomic_increment( sp_int32_t * pw ) 
{ 
    __sync_fetch_and_add( pw, 1 ); 
} 

The problem is, that the atomic builtin __sync_fetch_and_add is not
supported by gcc on ARM. 


The current boost SVN trunk fixes that problem by changing

boost/detail/sp_counted_base.hpp:
- #elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) 
+ #elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
&& !defined( __arm__ )
...
#else
- // Use #define BOOST_DISABLE_THREADS to avoid the error
- # error Unrecognized threading platform
+ # include <boost/detail/sp_counted_base_spin.hpp>
#endif

Additionally boost/detail/sp_counted_base_spin.hpp is added.

Best regards,
Kai





More information about the pkg-boost-devel mailing list