[csw-maintainers] Undefined symbol __sync_fetch_and_add_4.

rupert THURNER rupert at opencsw.org
Tue Dec 22 11:30:24 CET 2009


On Tue, Dec 22, 2009 at 11:25, Maciej (Matchek) Blizinski
<maciej at opencsw.org> 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:
>
> gmake[3]: Entering directory
> `/home/maciej/src/opencsw/pkg/googletest/trunk/work/build-isa-sparcv8/gtest-1.4.0'
> /bin/bash ./libtool --tag=CXX   --mode=link /opt/csw/gcc4/bin/g++  -O2
> -pipe -mcpu=v8  -L/opt/csw/gcc4/lib/. -mcpu=v8 -L/opt/csw/lib -o
> samples/sample1_unittest samples/sample1_unittest.o
> lib/libgtest_main.la samples/libsamples.la
> /opt/csw/gcc4/bin/g++ -O2 -pipe -mcpu=v8 -mcpu=v8 -o
> samples/.libs/sample1_unittest samples/sample1_unittest.o
> -L/opt/csw/gcc4/lib/. -L/opt/csw/lib lib/.libs/libgtest_main.so
> /home/maciej/src/opencsw/pkg/googletest/trunk/work/build-isa-sparcv8/gtest-1.4.0/lib/.libs/libgtest.so
> samples/.libs/libsamples.a /opt/csw/gcc4/lib/libstdc++.so -lm  -Wl,-R
> -Wl,/opt/csw/lib -Wl,-R -Wl,/opt/csw/gcc4/lib
> ld: warning: file /opt/csw/gcc4/lib/./libstdc++.so: linked to
> /opt/csw/gcc4/lib/libstdc++.so: attempted multiple inclusion of file
> 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
> ld: fatal: Symbol referencing errors. No output written to
> samples/.libs/sample1_unittest
> gmake[3]: *** [samples/sample1_unittest] Error 1
>
> Have you solved it?

maybe use "-march=i486" as compiler flag?

rupert.



More information about the maintainers mailing list