Running Geant4 with CLION

Hello, I’ve encountered the following error when trying to run geant4 with clion:
"…Geant4_work_dir/cmake-build-debug/sim: error while loading shared libraries: libG4graphics_reps.so: cannot open shared object file: No such file or directory

Process finished with exit code 127"

I think I’ve found the solution to it. Marked as solution to this topic.

As suggested in this following stack question:

You’ll need to go to:

Run -> Edit Configurations -> (select your application) -> Environment variables

Then, manually set your LD_LIBRARY_PATH:

LD_LIBRARY_PATH=*other paths you might need*:/Geant4 install location/lib

Try to run your application again. Your configuration should look like this:

Note that the path to the Geant4_install_dir/lib is concealed by CLION, but it’s there.

You might run to further problem:

G4ENSDFSTATEDATA environment variable must be set

Using the following answer:

Add the following to your env variables line:

*LD_LIB_PATH_FROM_BEFORE*;G4ENSDFSTATEDATA=/GEANT4_INSTALL_DIR/share/Geant4-10.7.3/data/G4ENSDFSTATE2.3

Be sure to use the following resource for future errors:
https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/postinstall.html

For reference, my env variable line is as follows:

LD_LIBRARY_PATH=/home/jordan/msc/software/root/root-install/lib:/usr/lib/x86_64-linux-gnu:/home/jordan/msc/software/geant4/geant4-install/lib:/home/jordan/msc/software/geant4/geant4-install/lib:/usr/lib/x86_64-linux-gnu;G4ENSDFSTATEDATA=/home/jordan/msc/software/geant4/geant4-install/share/Geant4-10.7.3/data/G4ENSDFSTATE2.3

Try to run again, should work.

I hope this helps,
Jordan.

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