[osg-users] G++ version problem

Alberto Luaces aluaces at udc.es
Mon Apr 4 00:33:32 PDT 2011


Hi Mathias, Grahame,

Mathias Fröhlich writes:

> Good morning,
>
> On Monday 04 April 2011, Grahame Bowland wrote:
>> `__sync_bool_compare_and_swap_4' src.cxx:(.text+0x78): undefined reference
>> to `__sync_bool_compare_and_swap_4' collect2: ld returned 1 exit status
>> gmake[1]: *** [cmTryCompileExec] Error 1
>> gmake: *** [cmTryCompileExec/fast] Error 2
>>
>> It does seem the builtins are disabled. As Alberto said probably because
>> they're not available for the default 32-bit compiler target, Here's the
>> 'g++ -v' output:
>>
>> Using built-in specs.
>> Target: i686-pc-linux-gnu
>> Configured with: ./configure --prefix=/opt/gcc-4.4.3
>> --with-mpfr=/opt/mpfr-2.3.2 --enable-languages=c,c++,objc Thread model:
>> posix
>> gcc version 4.4.3 (GCC)
>
> There is a configure time switch in gcc that changes the default architecture. 
> Distributions usually have their compiler configured for something that 
> includes support for atomics. But your hand configured gcc uses the really 
> conservative i386 (not i486, really 80386) default which did not have any smp 
> support at this very old time.
> So either give -march=i686 or something sensible for your project to the c and 
> c++ flags when doing the cmake configure step. Or rebuild gcc with the 
> configure flag --with-cpu=i686 or something sensible for your build 
> environment. Then rebuild osg from scratch.

I agree; if you are only going to use that OSG version with the same
computer or with another having the same or later CPU, maybe the easiest
way is to use -march=native as I said earlier. If you are not sure about
what kind of processors are going to run the code, you'll have to find a
common base architecture like the one suggested by Mathias, -march=i686.

There is a comprehensive list at

http://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options

Again, please note that this will enforce a constraint on the minimum
CPU requirement for the systems running your software.

-- 
Alberto




More information about the osg-users mailing list