Unable to idenfity error when installing g4py environment


I am attempting to install g4py in order to interface with Geant4 via python (preferable python3). However after following all instructions I could find I am still unable to install it.

I am using a machine with Ubuntu 18.04 in WSL.

After downloading the source I install with the following compilation flags:


After the install is successful I begin to install g4py. I go to environments/g4py and follow the instructions in https://github.com/Geant4/geant4/tree/geant4-10.5-release/environments/g4py.

After defining GEANT4_INSTALL=$HOME/opt/geant4-install-g4py and running cmake .. -DCMAKE_INSTALL_PREFIX=$GEANT4_INSTALL everything seems to be working correctly until the very end where I get an error

This is the output of the cmake command:

-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Geant4: /home/lobis/opt/geant4-install-10.5-release-MT/bin/.. (10.5.1)
-- Found PythonInterp: /home/lobis/anaconda3/bin/python (found version "3.7.3")
-- Found PythonLibs: /home/lobis/anaconda3/lib/libpython3.7m.so (found version "3.7.3")
-- Boost version: 1.65.1
-- Found XercesC: /usr/lib/x86_64-linux-gnu/libxerces-c.so
-- Found ROOT 6.16/00 in /home/lobis/opt/root/root-6.16.00/install-gdml
-- --------------------------------------------------------
-- Parameters for building
-- CMAKE_CXX_COMPILER: /usr/bin/c++
-- CMAKE_INSTALL_PREFIX: /home/lobis/opt/geant4-install-10.5-release-MT
-- --------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lobis/opt/geant4/source/geant4/environments/g4py/build

attached you can find the output of the make command.

make_output.txt (28.7 KB)

These are the last lines of make command:

[ 94%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4Tubs.cc.o
[ 95%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4TwistedBox.cc.o
[ 95%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4TwistedTrap.cc.o
[ 96%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4TwistedTrd.cc.o
[ 96%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4TwistedTubs.cc.o
[ 96%] Linking CXX shared library G4global.so
[ 96%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4UniformMagField.cc.o
[ 96%] Built target pyG4global
[ 97%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4UnionSolid.cc.o
[ 97%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4VPhysicalVolume.cc.o
[ 97%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4VSolid.cc.o
[ 98%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pyG4VTouchable.cc.o
[ 98%] Building CXX object source/geometry/CMakeFiles/pyG4geometry.dir/pymodG4geometry.cc.o
[100%] Linking CXX shared library G4geometry.so
[100%] Built target pyG4geometry
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

(for some reason the % at it fails is different)

I could not find a way to configure the installation via cmake variables but in older versions I found this could be done via the configure script, I assume in the newer versions this is not necessary?

I look forward to hearing any advice, thanks!

Were you able to solve this? I’m attempting to install g4py in WSL for the first time and am having significant challenges. It installed fine on my personal Linux laptop, but WSL on my work computer is not happy with it.