Boost logo

Boost-Build :

Subject: Re: [Boost-build] __sync_val_compare_and_swap_4
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-07-21 10:13:57

On Wednesday 21 July 2010 12:08:07 Madhukar Sandi wrote:

> Hi
> When im doing cross compiling boost libraries on Cronus mips board.
> I am getting below error
> undefined reference to `__sync_val_compare_and_swap_4'
> Please any one have solution , pls share with me
> user_at_user-desktop:~/madhukar/boost/boost_1_43_0/workspace/interprocess/messageque$ mips-linux-g++ -lpthread -lrt -g -march=mips32 comp_doc_message_queueA.cpp -o mess -I/home/user/madhukar/boost/boost_1_43_0/ ../../../stage/lib/libboost_thread.a
> I got below error....
> /tmp/ccVKlA7S.o:/home/user/madhukar/boost/boost_1_43_0/boost/interprocess/detail/atomic.hpp:306: undefined reference to `__sync_val_compare_and_swap_4'
> collect2: ld returned 1 exit status

Opening that file gives me this code:

        #elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
        inline boost::uint32_t atomic_cas32
           (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)
        { return __sync_val_compare_and_swap(const_cast<boost::uint32_t *>(mem), cmp, with); }

Now, well, this gcc builtin appears to be not implemented in your compiler. I don't know whether it's not
generally implemented on MIPS, or implemented in a later version, and how to implement it.

I'm afraid your only option is to file a bug with the interprocess library, on,
or raise this question on the Boost mailing list.


Vladimir Prus

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at