Geant4 compling error of a repo

Dear user,

i am just a beginner user on Geant4. i have to tried LaBr3 code via https://github.com/giglio0/DRAGON-G4-LaBr3.git. after the configuration while creating build files with make command, the process send a error message.

Scanning dependencies of target LaBr3_v4
[ 9%] Building CXX object CMakeFiles/LaBr3_v4.dir/LaBr3_v4.cc.o
[ 18%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorConstruction.cc.o
[ 27%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorMessenger.cc.o
[ 36%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/EventAction.cc.o
[ 45%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o
/home/cancan/Gatev9/example_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory
29 | #include <TH1D.h>
| ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LaBr3_v4.dir/build.make:134: CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/LaBr3_v4.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

in the begining i thought it was about root libraries so that i re-install the root with use “-Dall=ON”. i hoped it could be fix the error but couldn’d. After that, i checked the Cmakelist of the repo but like i said before i coundn’t see HistoManager.cc file list of the sources. maybe you thing i am silly but i said before i am just beginer so i added source directory of histomanager.cc among of source list in cmakelist.txt file. Of course it wasn’t also work.

list(APPEND sources
{PROJECT_SOURCE_DIR}/src/DetectorConstruction.cc {PROJECT_SOURCE_DIR}/src/DetectorMessenger.cc
{PROJECT_SOURCE_DIR}/src/EventAction.cc {PROJECT_SOURCE_DIR}/src/PhysicsList.cc
{PROJECT_SOURCE_DIR}/src/PrimaryGeneratorAction.cc {PROJECT_SOURCE_DIR}/src/RunAction.cc
{PROJECT_SOURCE_DIR}/src/SteppingAction.cc {PROJECT_SOURCE_DIR}/src/TrackingAction.cc)

Can anbody help me?

We don’t know the G4 build system that well. Maybe calling source wherever/your/ROOT/is/bin/thisroot.sh before running cmake on the G4 build will fix this? Else please check with the Geant forum!

you are right and i also shared my error with Geant forum. accually i created this topic because i wanted to learn that if i want to install all libraries of root, is it enough add [-Dall=ON] to continue the cmake command when i configurate the the root.

I think this is likely due to changes to ROOT’s ROOTConfig.cmake file (the repo in question is 4yrs old). The error:

is pointing to the include directory(ies) for ROOT not being added to the build. See the ROOT docs here:

and check that the correct CMake variables/target are being used in the project’s CMakeLists.txt.

1 Like