[csw-maintainers] Undefined symbol __sync_fetch_and_add_4.

Roger Håkansson hson at opencsw.org
Tue Mar 30 06:26:14 CEST 2010


On 2009-12-22 11:25, Maciej (Matchek) Blizinski wrote:
> 2009/11/8 Trygve Laugstøl<trygvis at opencsw.org>:
>> I'm trying to build freehdl on build8s, but when it's linking the final
>> binary I'm getting an error about a missing symbol "__sync_fetch_and_add_4"
>>
>> This seems to be a function that use atomic instructions that's not on i386
>> and sparc 8 so i686 has to be used. I assume the problem is similar on
>> sparc, but I have no idea which flags to use. Does anyone know?
>>
>> http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html#Atomic-Builtins
>
> I just saw the same problem:
>
...
> Undefined                       first referenced
>   symbol                             in file
> __sync_fetch_and_add_4
> /home/maciej/src/opencsw/pkg/googletest/trunk/work/build-isa-sparcv8/gtest-1.4.0/lib/.libs/libgtest.so

I've stumbled upon the same problem, but also found the way to solve it.

Instead of having -mcpu=v8 as a compiler option, replacing it with -m32 
will solve it.


More information about the maintainers mailing list