# Running Geant4 with CLION

**URL:** <https://geant4-forum.web.cern.ch/t/running-geant4-with-clion/9720>\
**Category:** Getting Started\
**Created:** [January 14, 2023, 10:02am UTC](https://geant4-forum.web.cern.ch/t/running-geant4-with-clion/9720 "2023-01-14T10:02:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yardencarmel](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/yardencarmel/32/5870_2.png) [@yardencarmel](https://geant4-forum.web.cern.ch/u/yardencarmel)\
**Post date:** [January 14, 2023, 10:02am UTC](https://geant4-forum.web.cern.ch/t/running-geant4-with-clion/9720/1 "2023-01-14T10:02:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yardencarmel](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/yardencarmel/32/5870_2.png) [@yardencarmel](https://geant4-forum.web.cern.ch/u/yardencarmel)\
**Post date:** [January 14, 2023, 10:11am UTC](https://geant4-forum.web.cern.ch/t/running-geant4-with-clion/9720/2 "2023-01-14T10:11:44Z")

</div>

As suggested in this following stack question:

> <https://stackoverflow.com/questions/41979148/clion-cant-find-shared-library-when-running-an-executable/41983223#41983223>

You’ll need to go to:

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

```

Then, manually set your `LD_LIBRARY_PATH`:

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

```

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

 ![image](https://geant4-forum.web.cern.ch/uploads/default/original/2X/1/1f314b0400a6e5357aa29b7161339511f2121ad8.png)

Note that the path to the Geant4\_install\_dir/lib is concealed by CLION, but it’s there.

You might run to further problem:

```auto
G4ENSDFSTATEDATA environment variable must be set

```

Using the following answer:

> <https://stackoverflow.com/questions/56790096/ensdfstate-dat-file-not-found-error-while-running-exampleb1-exe-using-geant4/59994334#59994334>

Add the following to your env variables line:

```auto
*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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://geant4-forum.web.cern.ch/uploads/default/original/1X/ce519a43ebdf7ac48a98a03c6ad6eea013b68c46.png) [@system](https://geant4-forum.web.cern.ch/u/system)\
**Post date:** [January 21, 2023, 10:12am UTC](https://geant4-forum.web.cern.ch/t/running-geant4-with-clion/9720/3 "2023-01-21T10:12:45Z")

</div>

Closed on January 21, 2023, 10:12am UTC

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