In a previous post #3642 a recipe to build Geant4 via brew has been discussed. The local formula works fine and Geant4 is properly built.
OTOH, that formula doesn’t include the Geant4 python bindings, which I tried to include by adding the flags “-DGEANT4_USE_PYTHON=ON”. Surprisingly, it does not work as expected and I get several errors similar to the one below:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:329:9: error: no
member named 'isunordered' in the global namespace
13 errors generated.
It seems I have a broken link within the clang toolchain, maybe because I’m not using Xcode but only Command Line Tools.
Partial solution: the same issue is seen when I try to compile the examples in Geant4 without g4py, which can be easily cured with the following flag within the cmake command:
Building from source: I left brew behind and tried to build geant4 from source using the DCMAKE_OSX_SYSROOT flag, but unfortunately this flag does not solve the issue in building Geant4 with g4py (either brew or from source, but works for examples). The information present in the documentation (link) seems to not be enough to fix the issue from my side.
Is there a proper way to pass the DCMAKE_OSX_SYSROOT flag to build Geant4 with g4py?
and it works fine (but does not work without the -isystem and -isysroot flags). Possibly I have some weird config in my MacOS system that Geant4 cmake is not getting the proper c++ headers, so any help is welcome.
I followed that post and I do have boost-python3 and set those flags either in the brew formula or building from source. It seems that my toolchain is looking for math.h at /usr/local/include instead of /Library/Developer/CommandLineTools/:
I removed Xcode last month, but haven’t seen any issue until trying to install this python binding. Apart of avoiding install Xcode again, I believe there is a clever way to compile Geant4 in a smart way with CommandLineTools…
Note: I do have a gcc installed via brew. I’m planning to remove it as a cross-check, but it’s linked to other formulas so I have to plan it first.
I don’t think so, because I can compile the examples using that cmake flag. I believe it’s just a matter of linking it properly for building Geant4 with g4py.
Given that I have a gcc installed via brew, I suspect that boost-python3 may be linked to this gcc instead of Command Line Tools.
Just to give a more clear view, my compilation process crashes at 95% when compiling G4PyCoutDestination.cc:
[ 95%] Building CXX object environments/g4py/source/global/CMakeFiles/pyG4global.dir/G4PyCoutDestination.cc.o
In file included from $HOME/Downloads/geant4.10.07.p01/environments/g4py/source/global/G4PyCoutDestination.cc:32:
In file included from $HOME/Downloads/geant4.10.07.p01/environments/g4py/source/global/G4PyCoutDestination.hh:34:
In file included from $HOME/Downloads/geant4.10.07.p01/source/global/management/include/G4coutDestination.hh:42:
In file included from $HOME/Downloads/geant4.10.07.p01/source/global/management/include/globals.hh:35:
In file included from $HOME/Downloads/geant4.10.07.p01/source/global/management/include/G4ios.hh:35:
In file included from $HOME/Downloads/geant4.10.07.p01/source/global/management/include/G4Types.hh:74:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/complex:245:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:317:9: error: no
member named 'signbit' in the global namespace