Search code examples
c++macosgcccmath

Compiling C++ files when including cmath in header


I have recently installed gcc from http://hpc.sourceforge.net/ and while everything else works fine whenever I try to include cmath in the header it is showing the following error:

/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/5.0.0/include-fixed/math.h:273:5: internal compiler error: Illegal instruction: 4
     return __inline_isfinitef(__x) && __builtin_fabsf(__x) >= __FLT_MIN__;
     ^

/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/5.0.0/include-fixed/math.h:273:5: internal compiler error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Abort trap: 6

I'm using OSX Yosemite and on typing gcc -v it shows the following:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin13.4.0/5.0.0/lto-wrapper
Target: x86_64-apple-darwin13.4.0
Configured with: ../gcc-5-20140928/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 5.0.0 20140928 (experimental) (GCC) 

Thanks in advance for your time.


Solution

  • This can happen when the GMP library was compiled for CPU which provides instructions not available on the runtime CPU, see gmp CPU identification