Issues with headers when compiling example application

I am trying to run some examples (for instance B4), but when compiling it it fails giving as error:

/home/fnardi/sim/basic/B4/B4a/ fatal error: G4RunManagerFactory.hh: No such file or directory
   33 | #include "G4RunManagerFactory.hh"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I’ve looked a bit into it, and the library should be in my Geant4 version (11.0).
To compile it I source both GCC (9.3) and Geant4 from /cvmfs/, which worked fine in the machine I was using before migrating to a different one (same OS: centOS7).
Do you have any suggestion on how to fix this?
Thank you!


It’s probably that the found Geant4 install is pre 11.0, see for example Problem in detecting header files of geant4 in the simulation - #2 by bmorgan. What commands did you use to set things up from cvmfs?

Yeah that’s the only post I’ve found about it, but I think my version is >=10.7.
What I do is basically:

source /cvmfs/

source /cvmfs/

export CXX=`which g++` 
export CC=`which gcc`

# QT plugin path needs to be specified
export QT_PLUGIN_PATH=/usr/lib64/qt5/plugins/

I feel I might need to specify the library folder when running cmake, but I have little idea of how :pensive:

The Geant4 install that’s found by CMake can be checked via searching for the Geant4_DIR variable in the CMakeCache.txt file in your build directory. In general, the setup scripts should set either CMAKE_PREFIX_PATH or Geant4_DIR appropriately.

In CVMFS, I’d recommend using the LCG “views” under /cvmfs/ as these provide a better integration of a full toolset. There’s a full lists here:, though requires a CERN login. Generally, the latest releases, e.g. LCG_102 will have the latest Geant4 installed, though with some delays depending on LCG/SFT’s release schedule.

1 Like

Setting manually the Geant4_DIR when running cmake fixed the issue, it was pointing to scraps of an old G4 installation (indeed, 10.6).
Now I have some other packages missing, so I’ll try to use a LCG view instead.
Thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.