CMake error for Geant4 compilation on centos7


For compatibility reasons, I have to use GEANT4 v10.1.3.

I am working on centos7, using a CERN VM machine,
CC7-x86_64, up-to-date, all Geant4 dependencies installed, compiler gcc 7.3 from devtoolset-7, cmake3 version 3.14.6.

Trying to compile it, I get the following error

CMake Error at cmake/Modules/Geant4MacroLibraryTargets.cmake:111 (add_library):
Cannot find source file:


Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx is indeed not there for v10.1.3 (well, the file name is capitalized in cmake module, but with small letters in the release,

Here is the recipe to reproduce the error (bash shell), for testing I switched off some options (qt, opengl, …)

mkdir build
export GEANT4_VERSION=“v10.1.3”
export GEANT4_INSTALL_PREFIX="/usr/local/geant4/{GEANT4_VERSION}" cd build export SRC_GEANT4="../src/geant4-{GEANT4_VERSION}"
export QTDIR="/usr/lib64/qt5"
export PATH="/usr/lib64/qt5/bin:PATH" git clone -b {GEANT4_VERSION} {SRC_GEANT4} scl enable devtoolset-7 bash cmake3 {SRC_GEANT4}

In the end, the simulation program will go into a singularity container (GEANT, ROOT, the simulation pprogram), to be run on some HPC.
I intend to migrate it directly to Geant4 10.6, but as of now I have to get some results with the old setup.

All v10.1.X versions give the same error, also when using devtoolset-6. LCG_86 has however v10.1.2 included, for centos7 architecture, but on HPC I can’t use SFT cvmfs, and integrating cvmfs in singularity is still a hassle.

Best regards,

Formatting went wrong, here is the correct recipe (hopefully preformated text stay as it is)

mkdir build
export GEANT4_VERSION="v10.1.3"
export GEANT4_INSTALL_PREFIX="/usr/local/geant4/${GEANT4_VERSION}"
cd build
export SRC_GEANT4="../src/geant4-${GEANT4_VERSION}"
export QTDIR="/usr/lib64/qt5"
export PATH="/usr/lib64/qt5/bin:$PATH"
git clone -b ${GEANT4_VERSION} ${SRC_GEANT4}
scl enable devtoolset-7 bash
cmake3 ${SRC_GEANT4} \
         -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
         -DGEANT4_BUILD_CXXSTD=c++11 \
         -DGEANT4_USE_GDML=ON \
         -DGEANT4_USE_QT=OFF \
         -DGEANT4_USE_OPENGL_X11=OFF \
         -DGEANT4_USE_XM=OFF \

It looks like there’s an issue with the case of the filename in the tags. Not sure how or why that has happened, but you can copy to and reconfigure.

I’f afraid we’re no longer patching the 10.1 release (now 5 years old). I’d encourage migration to the latest 10.6 release, and of course ask for help if there are issues updating the application to this release!.

Hi Ben,

Thanks. I was also thinking to “rename” the file, but I am afraid it’s not the only case with case problem - I will try in any case. What puzzled me a bit was that 10.2.X compiles, even if the name still has the same case problem - but looking again in the repository, I saw that in fact there are two identical files and

If there are other case issues, they can likely be fixed the same way. They are probably caused by old name/rename plus case sensitive/insensitive filesystems. If the number of issues get excessive, please let us know just in case we need to investigate further.

Adding in my script (after git clone command)

# temporary fix for CMake error
cp -p "${SRC_GEANT4}/source/visualization/HepRep/src/" "${SRC_GEANT4}/source/visualization/HepRep/src/"
cp -p "${SRC_GEANT4}/source/visualization/HepRep/src/" "${SRC_GEANT4}/source/visualization/HepRep/src/"

solved the CMake error. I prefer making a copy of files with wrong case name instead of renaming the files.

Thanks again for help.