10.7.0 : Can't `ninja clean` to clean up build directory

Not sure if this is a geant4 issue or not

I like to clean my build directory to save space and am trying out the GEANT4_USE_PYTHON functionality, however if I run ninja clean it fails

# ninja clean
[1/1 (1) 1.6/s 0.615] Cleaning all built files...
FAILED: clean
/usr/bin/ninja -t clean
ninja: error: remove(environments/g4py/source/__pycache__): Directory not empty
Cleaning... 3380 files.
ninja: build stopped: subcommand failed.

The same things does not happen with make and that cleans without issue.

My full cmake command is

cmake -GNinja -DGEANT4_USE_PYTHON=ON -DCMAKE_INSTALL_PREFIX=/usr/local/share/geant4/10.7.0/install/debug -DGEANT4_INSTALL_DATADIR=/usr/local/share/geant4/data -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_BUILD_TLS_MODEL=global-dynamic -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEANT4_USE_QT=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON /usr/local/share/geant4/geant4

I think this is a CMake/ninja issue (searching around reveals similar issues with ninja clean and directories), but there are indications there are ways to fix this in CMake scripts. Will take a look, but may not be until New Year given current timetables.

Thanks, not a major issue for me but happy to hear it’s fixable.

1 Like