Geant4 11.0.1 on macOS with ARM SOC

Hi all,

I’ve got a (somewhat) working install of Geant4 v11.0.1 on a Mac with the following setup information:

OS version: macOS 12.3.1
Vendor/compiler version: Xcode 13.1
CMake version: 3.22.3
GNU Make version: 3.81
SOC: M1 Pro

I’m able to build Geant4 with little difficulty and compile and run examples as well. For completeness, here is the CMake command I pass to build Geant4 (I’ve replaced long and boring pathnames with shorthand versions for clarity):

cmake -DGEANT4_INSTALL_DATADIR=$g4data -DGEANT4_USE_OPENGL_X11=ON 
-DGEANT4_USE_GDML=ON -DGEANT4_BUILD_MULTITHREADED=ON 
-DXERCESC_ROOT_DIR=$opt_incl/xercesc -DXQuartzGL_INCLUDE_DIR=$opt_incl 
-DXQuartzGL_gl_LIBRARY=$opt_lib/libGL.dylib -DXQuartzGL_glu_LIBRARY=$opt_lib/libGLU.dylib 
-DGEANT4_USE_QT=ON -DCMAKE_INSTALL_PREFIX=$g4install $g4source

The problem I’m running into is that, with no pattern that I’ve been able to discern, running CMake or Make to build and compile external Geant4 projects will create duplicate directories and files in the $g4build directory and sometimes in the $g4source directory. This causes my projects to fail at either CMake or Make. Running make uninstall obviously does not remove these directories, and the only fix I’ve found is to completely start over and reinstall Geant4 (in fact, I made a zsh script to automate this process fully because of how often I’ve had to do it). For obvious reasons this is not ideal.

As an example, I’ve attached a screenshot of $g4build/source/CMakeFiles/G4run.dir to show what I’m talking about. Also note on the far left of the screenshot that most of the directories directly within $g4build have a duplicate.

I suspect there’s some macOS weirdness going on with CMake or Make not being able to overwrite directories and instead duplicating them, but I’m not sure how to fix it (or if this is even the issue). Any help is greatly appreciated.

Cheers.