[osg-users] G++ version problem

Grahame Bowland grahame at fugro-fsi.com.au
Sun Apr 3 20:04:20 PDT 2011

On Fri, 2011-04-01 at 12:06 +0200, Alberto Luaces wrote:
> > The gcc _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS test should pass for both
> > gcc 4.4.3 and 4.5.2.  I used plenty of gcc versions prior to 4.4.3 and
> > it worked fine.   I'm currently using gcc 4.4.5 on this system and it
> >
> > This make me wonder why your build with 4.4.3 isn't picking up on the
> > atomic support correctly.  Has anyone else had problems with picking
> > up on the atmoic support?
> A reason can be the fact that some systems select different default
> architectures. If you are using a 32 bit system instead of amd64, and
> say your compiler is set by default to produce 586 or 686 compatible
> binaries, chances are that the gcc builtins are deactivated. You would
> have to specify the target architecture explicitly,
> eg. -march=native. Those default configurations can be checked with `gcc
> -v'.

Here's the output of the test from CMakeError.log:
Performing C++ SOURCE FILE Test _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS failed with the following output:
Change Dir: /scratch/grahame/test/OpenSceneGraph-2.8.2-rc4/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory `/scratch/grahame/test/OpenSceneGraph-2.8.2-rc4/CMakeFiles/CMakeTmp'
/opt/toolchain32/bin/cmake -E cmake_progress_report /scratch/grahame/test/OpenSceneGraph-2.8.2-rc4/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec.dir/src.cxx.o
/opt/gcc-4.4.3/bin/g++    -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -W
unused -fpermissive  -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS   -o CMakeFiles/cmTryCompileExec.dir/src.cxx.o -c /scratch/grahame/test/Op
Linking CXX executable cmTryCompileExec
/opt/toolchain32/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/opt/gcc-4.4.3/bin/g++     -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -
Wunused -fpermissive  -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS   CMakeFiles/cmTryCompileExec.dir/src.cxx.o  -o cmTryCompileExec -rdynami
gmake[1]: Leaving directory `/scratch/grahame/test/OpenSceneGraph-2.8.2-rc4/CMakeFiles/CMakeTmp'
CMakeFiles/cmTryCompileExec.dir/src.cxx.o: In function `main':
src.cxx:(.text+0x4c): undefined reference to `__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)

Thanks for all the help!


More information about the osg-users mailing list