Homebrew gcc can't find omp.h on OS X - c++

I've spent hours trying different solutions but nothing has worked so far.
I've installed gcc via Homebrew, and linked gcc to the Homebrew gcc. gcc -v returns this:
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/5.3.0/libexec/gcc/x86_64-apple-darwin14.5.0/5.3.0/lto-wrapper
Target: x86_64-apple-darwin14.5.0
Configured with: ../configure --build=x86_64-apple-darwin14.5.0 --prefix=/usr/local/Cellar/gcc/5.3.0 --libdir=/usr/local/Cellar/gcc/5.3.0/lib/gcc/5 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion='Homebrew gcc 5.3.0 --without-multilib' --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 5.3.0 (Homebrew gcc 5.3.0 --without-multilib)
However, when I try to compile I get
This is make_MWA_Tools.sh
using $CFITSIO =
building LFILE & read_mwac utilities
cc -g -O -Wall -D_FILE_OFFSET_BITS=64 -fopenmp -c mwac_utils.c
mwac_utils.c:3:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
make: *** [mwac_utils.o] Error 1
!!!!!!!!!!!!!!!!!!!!!!
build_lfiles/read_mwac make failed !
I've looked in gcc located under Cellar and found mop.h, but for some reason its not being included. Any help would be greatly appreciated.
Edit: I don't believe this is a duplicate question because I could not find another question that Installed gcc from Homebrew, linked 'gcc' to the homebrew gcc installation, and still couldn't find omp.h

Related

boost built project on i386 fails to link

I am using a project named "GenericMod" which internally uses boost library 1.58.0.
Previously the boost 1.58 was compiled on a Red Hat Enterprise Linux Server release 5.8 (Tikanga)
whose gcc -v output was as follows
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)
It was compiled using the following command
./b2 install -a --includedir=testbuild/include --libdir=testbuild/lib --layout=system variant=release target-os=linux link=static runtime-link=static address-model=32 cxxflags=-fPIC
Now, when the project "GenericMod" was build, on the same machine, build was successful and there was no error.
But recently the build environment was changed. The project is being built in a new machine now which is Red Hat Enterprise Linux Server release 5.9 (Tikanga)
and its gcc -v output
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)
When the project is built in this machine now, i was getting linker errors (probably as the boost libraries were built on a different environment).
So i built the boost 1.58.0 in this machine again with the same build command.
./b2 install -a --includedir=testbuild/include --libdir=testbuild/lib --layout=system variant=release target-os=linux link=static runtime-link=static address-model=32 cxxflags=-fPIC
Now when the project is built in this machine, my understanding is that there shouldnt be any error and the build should go through link phase.
But the linker error still occurs.
libboost_thread.a(thread.o): In function `boost::thread::physical_concurrency()':
thread.cpp:(.text+0x2084): undefined reference to `std::ctype<char>::_M_widen_init() const'
Can someone please explain why is this happening ? I have been breaking my head past week for this and couldn;t get enough explanation in other places.
Should i include some flag to specify the build for i386?
Thanks in advance

caffe installation: gcc error namespace "std" has no member "isnan"

I'm trying to install (py)caffe on ubuntu 17.10
However when I do make all I get the following error:
./include/caffe/common.hpp(84): error: namespace "std" has no member "isnan"
./include/caffe/common.hpp(85): error: namespace "std" has no member "isinf"
2 errors detected in the compilation of "/tmp/tmpxft_00004921_00000000-19_nesterov_solver.compute_61.cpp1.ii".
Makefile:594: recipe for target '.build_release/cuda/src/caffe/solvers/nesterov_solver.o' failed
or when I use cmake instead
/home/thijser/caffe/include/caffe/common.hpp(84): error: namespace "std" has no member "isnan"
/home/thijser/caffe/include/caffe/common.hpp(85): error: namespace "std" has no member "isinf"
2 errors detected in the compilation of "/tmp/tmpxft_00004e32_00000000-7_math_functions.cpp1.ii".
CMake Error at cuda_compile_1_generated_math_functions.cu.o.Release.cmake:282 (message):
Error generating file
/home/thijser/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o
Note that I'm not just going for sudo apt-get install caffe as doing so does not also install pycaffe, any solution that also installs pycaffe is also valid. I understand that isnan in std likely comes via boost or that this somehow involves a discrepancy between c++ versions? I'm not much of a c++ expert so I'm not sure how that works, I use gcc4.9 for this as nvcc doesn't like later versions of gcc. I know that caffe works on other people's machines and on a older version of ubuntu I had installed so that suggests it's all a configuration issue.
Anybody know how to fix this?
edit using verbose mode on cmake I was able to find out that it doing the following as it happened
/usr/bin/cmake -E remove /home/thijser/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/cuda_compile_1_generated_math_functions.cu.o.depend.tmp /home/thijser/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/cuda_compile_1_generated_math_functions.cu.o.NVCC-depend
-- Generating /home/thijser/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o
/usr/bin/nvcc /home/thijser/caffe/src/caffe/util/math_functions.cu -c -o /home/thijser/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o -ccbin /usr/bin/cc -m64 -DCAFFE_VERSION=1.0.0 -Xcompiler ,\"-fPIC\",\"-Wall\",\"-Wno-sign-compare\",\"-Wno-uninitialized\",\"-O3\",\"-DNDEBUG\" -gencode arch=compute_61,code=sm_61 -Xcudafe --diag_suppress=cc_clobber_ignored -Xcudafe --diag_suppress=integer_sign_change -Xcudafe --diag_suppress=useless_using_declaration -Xcudafe --diag_suppress=set_but_not_used -DUSE_LMDB -DUSE_LEVELDB -DUSE_OPENCV -DWITH_PYTHON_LAYER -Xcompiler -fPIC -DNVCC -I/home/thijser/caffe/include -I/home/thijser/caffe/src -I/usr/include -I/usr/include/hdf5/serial -I/usr/include/opencv -I/usr/include/x86_64-linux-gnu -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/home/thijser/caffe/build/include -I/home/thijser/caffe/build
/home/thijser/caffe/include/caffe/common.hpp(84): error: namespace "std" has no member "isnan"
/home/thijser/caffe/include/caffe/common.hpp(85): error: namespace "std" has no member "isinf"
testing against the following code:
https://ideone.com/Yxvt5m
$ gcc -std=c++11 test.cpp which is the same as g++ test.cpp
gave me
test.cpp: In function ‘int main()’:
test.cpp:7:15: error: ‘__builtin_isnan’ is not a member of ‘std’
cout << std::isnan(42.0) << std::isinf(42.0);
^
test.cpp:7:15: note: suggested alternative:
<built-in>: note: ‘__builtin_isnan’
test.cpp:7:35: error: ‘__builtin_isinf_sign’ is not a member of ‘std’
cout << std::isnan(42.0) << std::isinf(42.0);
^
test.cpp:7:35: note: suggested alternative:
<built-in>: note: ‘__builtin_isinf_sign’
suggesting an configuration issue on my machine, however clang++ test.cpp did not give any error suggesting that maybe we could use that to install caffe?
$ gcc --version
gcc (Ubuntu 4.8.5-4ubuntu6) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$gcc -xc++ -E -v -
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.5-4ubuntu6' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.5 (Ubuntu 4.8.5-4ubuntu6)
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE - -mtune=generic -march=x86-64 -fstack-protector -Wformat -Wformat-security
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.8"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.8
/usr/include/x86_64-linux-gnu/c++/4.8
/usr/include/c++/4.8/backward
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
Edit: thanks to #EliahKagan 's suggestions in the askubuntu chat I found that adding in the line CXXFLAGS += g++ -D_GLIBCXX_USE_C99_MATH -std=c++11 to the makefile solves this issue, however it inimitably throws the next error of
thijser#AI-core-Regain:~/caffe/build$ make all
[ 0%] Building CXX object src/caffe/CMakeFiles/caffeproto.dir/__/__/include/caffe/proto/caffe.pb.cc.o
In file included from /home/thijser/caffe/build/include/caffe/proto/caffe.pb.cc:5:
/home/thijser/caffe/build/include/caffe/proto/caffe.pb.h:7:10: fatal error:
'string' file not found
#include <string>
^~~~~~~~
1 error generated.
In my case, I also met this error when I built caffe on ubuntu 17.10, but I finally found solution:
Let add the following to:
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h
/* #undef _GLIBCXX_USE_C99_MATH */
#define _GLIBCXX_USE_C99_MATH 1
After a long and detailed discussion with several of the people on the chat.askubuntu.com room #EliahKagan found out that there is a python3-caffe-cuda package which allows on to import caffe in python3. Note that this won't solve this issue for anyone in the future who has python2 but for me it works. In other words sudo apt-get install caffe and then using python3 rather then python2.7 worked for me.
Also note that we found that the underlying issue appears to be that gcc/g++ isn't finding the standard libraries (std) however it seems that clang and later version of gcc (gcc7)can find these libraries however these do not work with the current version of nvcc.
I am pretty sure you should set the right C++ standard. std::isnan is part of C++11 and newer GCCs use this version by default. Older ones still default to C++98.

How to install TBB on Windows and get it work with Eclipse

I want to install Intel's Thread Building Blocks on Windows and get it to work with the Eclipse IDE and C++. I've been new to the whole C, build from source, make, cmake, cygwin and other stuff.
What I've tried so far:
Load the TBB packages and source and try to include it in Eclipse
Try to 'make' TBB from source but only got Error 2 from GNUWin32make
Tried many tutorials, tips and much more that I don't remember any more
How can I do this?
Win 10 - 64bit, Eclipse Oxygen 4.7.0, cygwin 2.8.2, Compiler: mingw
As you can see in Release_Notes.txt, a library doesn't have a Cygwin support. However you have several cases:
Use Visual Studio and binary package
Use Linux (if you really need GCC)
Use Mingw without(!) Cygwin (difference). Building library from source code should work perfect in this case.
Port library to cygwin (it's a non-trivial but real solution)
lost the space by copiying here.
where g++
C:\Program Files\mingw-w64\x86_64-7.1.0-posix-seh-rt_v5-rev0\mingw64\bin\g++.exe
C:\MinGW\bin\g++.exe
g++ -v
Using built-in specs. COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=C:/Program\
Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/7.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32 Configured with:
../../../src/gcc-7.1.0/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident
-I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS='
-I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident
-L/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/lib -L/c/mingw710/prerequisites/x86_64-zlib-static/lib -L/c/mingw710/prerequisites/x86_64-w64-mingw32-static/lib ' Thread model: posix gcc version 7.1.0 (x86_64-posix-seh-rev0, Built by
MinGW-W64 project)

How to link allegro5 library to C++ project

I have got a C++ project written in CodeBlocks but I do not know how to link it with allegro5. I want to make people able to compile my project without installing any libraries or packages. So I put allegro directory downloaded from their webpage into project folder. Next I included library
#include "allegro/include/allegro5/allegro5.h"
But when I try to compile I have got an error
/home/stanek/ClionProjects/proj/guiMain.cpp:17: undefined reference to `al_install_system'
/home/stanek/ClionProjects/proj/guiMain.cpp:22: undefined reference to `al_create_display'
/home/stanek/ClionProjects/proj/guiMain.cpp:28: undefined reference to `al_map_rgb'
/home/stanek/ClionProjects/proj/guiMain.cpp:28: undefined reference to `al_clear_to_color'
/home/stanek/ClionProjects/proj/guiMain.cpp:30: undefined reference to `al_flip_display'
/home/stanek/ClionProjects/proj/guiMain.cpp:32: undefined reference to `al_rest'
/home/stanek/ClionProjects/proj/guiMain.cpp:34: undefined reference to `al_destroy_display'
This is my guiMain.cpp:
#include <iostream>
#include "allegro/include/allegro5/allegro5.h"
using namespace std;
int main(int argc, char **argv){
ALLEGRO_DISPLAY *display = NULL;
if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
And this is my CMakeList.txt
cmake_minimum_required(VERSION 3.3)
project(proj)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -std=c++11")
set(SOURCE_FILES guiMain.cpp)
add_executable(projids ${SOURCE_FILES})
UPDATE:
I have changed set in my CMakeList
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -std=c++11 'pkg-config --cflags --libs allegro-5.0 '")
but I have got an error:
Error:Configuration proj [Debug]
Compiler exited with error code 1: /usr/bin/c++ -xc++ -g -Wall -std=c++11 'pkg-config --cflags --libs allegro-5.0 ' -g -v -dD -E
c++: error: pkg-config --cflags --libs allegro-5.0 : No such file or directory
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5-20160209/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 5.3.0 (GCC)
and
Error:Configuration proj [Release]
Compiler exited with error code 1: /usr/bin/c++ -xc++ -g -Wall -std=c++11 'pkg-config --cflags --libs allegro-5.0 ' -O3 -DNDEBUG -v -dD -E
c++: error: pkg-config --cflags --libs allegro-5.0 : No such file or directory
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5-20160209/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 5.3.0 (GCC)
Actually, it is possible to allow others to play your game without intalling the allegro libraries on their system.
One approach is to statically link your executable to static versions of the
allegro libraries. The allegro wiki actually has a
tutorial
on how to do this with Code::Blocks.
In short, static linkage includes the necessary parts of Allegro directly in
your executable so the user doesn't have to worry about linking when they run
it.
Another option is to use dynamic linkage, but package the needed dynamic
libraries along with your game. For example,
your game folder might look like:
bin/
my_game.exe
liballegro.dll
liballegro_color.dll
...
Then the user can link to the libraries you have provided without worrying about what is installed on their system.
Note that dynamic libraries typically end with .so (Linux) or .dll (Windows) while static libraries end with .a.
Edit:
Just read you said compile and not run. If you want them to compile it themselves, you will need to include the libraries or instruct them on how to get the libraries themselves.

C++ MsgPack unable to compile

Am getting the following error when i tried to cmompile the code which uses the library
http://msgpack.org/ , i tried the first example in C++ section ( documentation of library )
g++ hello.cc -lmsgpack -o hello
/usr/local/lib/libmsgpack.so: undefined reference to `__sync_sub_and_fetch_4'
Any help is appreciable ..
g++ version details ..
$ g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
Please try updating your g++ compiler. Such error suggests that your compiler is too old and the code you are trying to compile is too new for it.
I am using g++ version 4.6.3 and there are no problems.
This one worked for me ...
Update your GCC tool-chain. Or try to add -march=pentium or -march=i486, etc.
#qehgt Thanks a lot :-)