GEOS
GEOS copied to clipboard
[BUG] Compile error for GEOSX lib LvArray/src/system.cpp - "no member named '__control' in 'fenv_t' ". Mac M1 architecture to blame?
Hi, I have been trying to compile GEOS on a Mac M1 pro Montery 12.2 (maybe for the last time) and I get the following error at compile time when I run make in my GEOS/builds-my-build/ directory (Skip below to see my diagnosis):
Building CXX object coreComponents/LvArray/src/CMakeFiles/lvarray.dir/system.cpp.o /Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:545:31: error: no member named '__control' in 'fenv_t' int const oldExcepts = fenv.__control & FE_ALL_EXCEPT; ~~~~ ^ /Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:548:8: error: no member named '__control' in 'fenv_t' fenv.__control &= ~newExcepts;
/Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:549:8: error: no member named '__mxcsr' in 'fenv_t'
fenv.__mxcsr &= ~(newExcepts << 7);
~~~~ ^
/Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:573:34: error: no member named '__control' in 'fenv_t'
int const oldExcepts = ~( fenv.__control & FE_ALL_EXCEPT );
~~~~ ^
/Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:576:8: error: no member named '__control' in 'fenv_t'
fenv.__control |= newExcepts;
~~~~ ^
/Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:577:8: error: no member named '__mxcsr' in 'fenv_t'
fenv.__mxcsr |= newExcepts << 7;
~~~~ ^
/Users/edoardopezzulli/Codes/Geos/GEOSX/src/coreComponents/LvArray/src/system.cpp:591:13: error: use of undeclared identifier 'FE_DFL_DISABLE_SSE_DENORMS_ENV'
fesetenv( FE_DFL_DISABLE_SSE_DENORMS_ENV );
^
**Analysis**
Although this level of coding is beyond me, I think the problem is there because system.cpp thinks that all Mac books have intel architectures ( x86 etc ). In doing so, it is using the <fenv.h> library while calling for members '__control' which only exist for intel architectures. Please check if fenv.h library is being called correctly if a Mac is using the M1 CPU.
(if this is all nonsense then forgive my ignorance)
I hope someone can help with this!
Any help will be greatly appreciated, thank you.
Edoardo
Hello @EdoardoPez I think we just need to disable floating point exceptions for the M1 architecture.
Resolved in #2074