I just installed the newest version of Geant4, version 11 following the YouTube guide by Physics Matters.
I’m still not very familiar with Ubuntu yet.
When I go to run exampleB1 to test if the installation has worked correctly, I get the following error:
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o /home/mjamie30/Geant4/geant4-v11.0.0/examples/basic/B1/exampleB1.cc:33:10: fatal error: G4RunManagerFactory.hh: No such file or directory
#include "G4RunManagerFactory.hh"
^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. CMakeFiles/exampleB1.dir/build.make:75: recipe for target ‘CMakeFiles/exampleB1.dir/exampleB1.cc.o’ failed make[2]: *** [CMakeFiles/exampleB1.dir/exampleB1.cc.o] Error 1 CMakeFiles/Makefile2:83: recipe for target ‘CMakeFiles/exampleB1.dir/all’ failed make[1]: *** [CMakeFiles/exampleB1.dir/all] Error 2 Makefile:135: recipe for target ‘all’ failed make: *** [all] Error 2
I can still run my older 10.7 simulations without issue.
The new version of Geant4 is installed in a new location not needing permissions.
I think it cant find the G4RunManagerFactory.hh, but I don’t know how to tell the new Geant4 version where to look or what to look for.
Don’t rely on unofficial videos - the official documentation is to be found on the Geant4 Web site.
I don’t know the solution to your specific problem, but Geant4 11.0 is a major release and some things have changed. Have a look at the Release Notes. Any changes required of the user should be prominently mentioned. In particular, look for anything about the analysis manager.
Try running make VERBOSE=1 to get the full compilation commands printed and check that the header paths to Geant4 correspond to where you installed 11.0. You can also check the contents of the CMakeCache.txt in the directory where you are building exampleB1 and look for the Geant4_DIR variable. This should point to where CMake found Geant4 and correspond to where you installed 11.0.
Thank you. Cmake was pointing to my old Geant4 build folder. My bad :\
But now I have a new error which happens when i run exampleB1 with and without the UI. ./exampleB1: symbol lookup error: ./exampleB1: undefined symbol: _ZN12G4RayTracerXC1Ev
In cmake curses, when I turn off WITH_GEANT4_UIVIS, (for testing), i get the error ./exampleB1: symbol lookup error: ./exampleB1: undefined symbol: _ZN21G4NistMaterialBuilder19FindOrBuildMaterialERK8G4Stringb
My searching online tells me that there is a linking issue?
using LD_DEBUG ./exampleB1 I get a huge output and at the end is 128981: ./exampleB1: error: symbol lookup error: undefined symbol: _ZN12G4RayTracerXC1Ev (fatal)
Deleting the exampleB1 build file, I noticed cmake GEANT4_DIR defaulted to the old version of Geant4 (not sure how to address this without repeatedly changing GEANT4_DIR for every new piece of work). However, I still get the same errors as above.
Same procedure as before - run make clean && make VERBOSE=1. Check that at the link step that G4RayTracer and other Geant4 libraries are linked. When built, run ldd ./exampleB1 and see if any of the listed libraries are marked as “not found”. Run readelf -d ./exampleB1 and see what libraries are listed as (NEEDED) and if there is an entry for (RPATH). Post the output from all of those here.
Thank you, I redid the process,
Deleted the build files, cmake, make clean, and it worked!
make VERBOSE=1 showed that G4RayTracer was linked correctly.
Also the cmake Geant4_DIR seems to permanently point to the new geant4 version; I tried B2a as well which worked.
I think the ‘make clean’ was what help.
Apologies, I started to get undefined symbol errors again.
The exampleB1 & B2 still works fine but as for my older work using GEANT4 10.7 & GEANT4 11, I get these errors.
I continued with what you suggested in your previous post.
Using ldd ./Activation (this is the G4 example I modified months ago), I get nothing marked “not found” that I can see.
Using readelf -d ./Activation I get a bunch of needed libraries. I cant see RPATH. Not sure why this is the case. Could it be because I update Cmake to version 3.22.2 from 3.18.1? or Geant4 to version 11?