Linking to ROOT in Geant4 on EL9

My department is switching from Centos7 to EL9. I now can’t run my Geant4 code that links to ROOT. It gives the message:

fatal error: module map file '/usr/share/root/cling/module.modulemap' not found

That file doesn’t exist, but it didn’t exist on the old system either.

I tried to build and run the example AnaEx02 and get the same problem. This is with EL9 / gcc12 / geant4 11.2 / root 6.30. It worked fine on Centos7 / gcc6.3 / geant4 10.5 / root 6.24. Our IT support were not able to fix this and suggested I contact the geant4 developers. Can anyone help?

This can be reproduced with this script:

source /cvmfs/sft.cern.ch/lcg/contrib/gcc/12/x86_64-el9/setup.sh
source /cvmfs/geant4.cern.ch/geant4/11.2/x86_64-el9-gcc12-optdeb-MT/CMake-setup.sh
export CXX=`which g++`
export CC=`which gcc`
cp -R /cvmfs/geant4.cern.ch/geant4/11.2/share/examples/extended/analysis/AnaEx02/ .
mkdir AnaEx02_build
cd AnaEx02_build/
cmake -DGeant4_DIR=/cvmfs/geant4.cern.ch/geant4/11.2/x86_64-el9-gcc12-optdeb-MT/lib64/Geant4-11.2.0 ../AnaEx02
make
./AnaEx02 AnaEx02.in

Could you try copying the below to a CMakeLists.txt file in an empty folder and then run cmake . please? It should match what Geant4 does in the gross setup, but take out anything else that might be causing problems. If this causes the same error, then there are a couple of things we can try.

cmake_minimum_required(VERSION 3.16...3.27)
project(checkroot)

find_package(ROOT REQUIRED)

file(WRITE checkroot.cc "
#include <TArrayD.h>
int main(){
  TArrayD d;
}
")
add_executable(checkroot checkroot.cc)
target_compile_features(checkroot PRIVATE cxx_std_17)
target_include_directories(checkroot PRIVATE ${ROOT_INCLUDE_DIRS})
target_link_libraries(checkroot ${ROOT_LIBRARIES})

Thanks for quick reply. That runs fine with no error message.

Sorry, just to be clear, with that CMakeLists.txt are you able to run:

cmake .
make

without error on either step? Can you also try with the setup for the Geant4 application, i.e.

source /cvmfs/sft.cern.ch/lcg/contrib/gcc/12/x86_64-el9/setup.sh
source /cvmfs/geant4.cern.ch/geant4/11.2/x86_64-el9-gcc12-optdeb-MT/CMake-setup.sh
export CXX=`which g++`
export CC=`which gcc`
cmake .
make

Yes I did all that with no errors when running cmake, make, or the checkroot executable.

Just to clarify my first post, the error occurred when running AnaEx02, not when running cmake or make.

Thanks for the info - could you post the full output when running AnaEx02 please? It would be useful to see exactly at what stage this occurs.

My suspicion is a problem with the local (I assume) install of root or possibly a compiler incompatibility between that and GCC 12.

That sounds very plausible. Here is the output (leaving out the first few hundred lines where it prints parameters):


=======================================================================
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
### Run 0 start.
Warning in <TClassTable::Add>: class ROOT::Internal::RRawFile already in TClassTable
Warning in <TClassTable::Add>: class TFileMerger already in TClassTable
Warning in <TClassTable::Add>: class TDirectoryFile already in TClassTable
Warning in <TClassTable::Add>: class TFile already in TClassTable
Warning in <TClassTable::Add>: class TMemFile already in TClassTable
Warning in <TClassTable::Add>: class ROOT::TBufferMerger already in TClassTable
Warning in <TClassTable::Add>: class ROOT::TBufferMergerFile already in TClassTable
Warning in <TClassTable::Add>: class TArchiveFile already in TClassTable
Warning in <TClassTable::Add>: class TArchiveMember already in TClassTable
Warning in <TClassTable::Add>: class TBufferIO already in TClassTable
Warning in <TClassTable::Add>: class TBufferFile already in TClassTable
Warning in <TClassTable::Add>: class TBufferText already in TClassTable
Warning in <TClassTable::Add>: class TBufferJSON already in TClassTable
Warning in <TClassTable::Add>: class TGenCollectionProxy already in TClassTable
Warning in <TClassTable::Add>: class TGenCollectionProxy::Value already in TClassTable
Warning in <TClassTable::Add>: class TGenCollectionProxy::Method already in TClassTable
Warning in <TClassTable::Add>: class TCollectionProxyFactory already in TClassTable
Warning in <TClassTable::Add>: class TCollectionStreamer already in TClassTable
Warning in <TClassTable::Add>: class TCollectionClassStreamer already in TClassTable
Warning in <TClassTable::Add>: class TCollectionMemberStreamer already in TClassTable
Warning in <TClassTable::Add>: class TEmulatedCollectionProxy already in TClassTable
Warning in <TClassTable::Add>: class TEmulatedMapProxy already in TClassTable
Warning in <TClassTable::Add>: class TFileCacheRead already in TClassTable
Warning in <TClassTable::Add>: class TFree already in TClassTable
Warning in <TClassTable::Add>: class TFileCacheWrite already in TClassTable
Warning in <TClassTable::Add>: class TFPBlock already in TClassTable
Warning in <TClassTable::Add>: class TFilePrefetch already in TClassTable
Warning in <TClassTable::Add>: class TKey already in TClassTable
Warning in <TClassTable::Add>: class TKeyMapFile already in TClassTable
Warning in <TClassTable::Add>: class TLockFile already in TClassTable
Warning in <TClassTable::Add>: class TMapFile already in TClassTable
Warning in <TClassTable::Add>: class TMapRec already in TClassTable
Warning in <TClassTable::Add>: class TStreamerInfo already in TClassTable
Warning in <TClassTable::Add>: class TStreamerInfoActions::TConfiguration already in TClassTable
Warning in <TClassTable::Add>: class TStreamerInfoActions::TConfiguredAction already in TClassTable
Warning in <TClassTable::Add>: class TStreamerInfoActions::TActionSequence already in TClassTable
Warning in <TClassTable::Add>: class TZIPFile already in TClassTable
Warning in <TClassTable::Add>: class TZIPMember already in TClassTable
fatal error: module map file '/usr/share/root/cling/module.modulemap' not found

 *** Break *** segmentation violation
    '/build/jenkins/workspace/lcg_release_pipeline/install/Python/3.9.12/x86_64-el9-gcc12-opt/lib/python39.zip',
    '/build/jenkins/workspace/lcg_release_pipeline/install/Python/3.9.12/x86_64-el9-gcc12-opt/lib/python3.9',
    '/build/jenkins/workspace/lcg_release_pipeline/install/Python/3.9.12/x86_64-el9-gcc12-opt/lib/lib-dynload',
Segmentation fault (core dumped)
[henry@pplxint12 AnaEx02_build]$ 

Yes, there seems to be a compatibility problem with the local root installation. I managed to get it working by replacing my usual setup script with

source /cvmfs/sft.cern.ch/lcg/views/LCG_105/x86_64-el9-gcc12-opt/setup.sh

Which has the same version of gcc and geant4 and a compatible version of root.

Thanks for your help