Trying to build git clone with msys2-mingw64: g++.exe: error: unrecognized command line option '-EHa'



I set stuff up to compile OCCT with msys2/mingw64, I have compiled OCE like this before and have compiled a vc14 version, but above error stops the mingw64 build dead in its tracks.
Also, uniquely, a google search show that no-one in the google verse ever encountered this.

Any pointers to remedy this ?
(also, where do I remedy this, where is this option set ?)


Andrey BETENEV's picture


Option -EHa is defined in adm/cmake/occt_defs_flags.cmake if "WIN32" is set -- in that case it is assumed (incorrectly) that compiler is Visual Studio. Apparently here "WIN32" should be replaced by "MSVC".

Note that in MSVC the opton -EHa enables support of unstructured exceptions. It does not affect normal execution of the program, however it is essential for OCCT support of conversion of low-level C signals to C++ exceptions, see OSD::SetSignal().

If you are going to use this feature on your system, you will likely have to adapt OCCT signal handlers defined in OSD_signal.cxx or OSD_signal_WNT.cxx to msys2/mingw64 specifics.