Error in running ExampleB1

Hello, dear all!
Please, help me!
I installed geant4_10_06 for Linux Mint 19.02.
I built exampleB1 and his compiling is well.
But when i would like run my exampleB1 i see this error:
" andy@andy:~/geant/b1$ ./exampleB1
./exampleB1: error while loading shared libraries: cannot open shared object file: No such file or directory "

next my command:
" andy@andy:~/geant/b1$ ldd exampleB1 | grep libG4graphics => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => not found => /usr/lib/x86_64-linux-gnu/ (0x00007f7d2216c000) => not found => not found => not found "

and this command:
" andy@andy:~/geant/b1$ locate
/home/andy/geant4/BuildProducts/lib/ "

so, my .bash_profile file:
export ROOTSYS=/opt/sw/root/pro
export PATH=$PATH:$ROOTSYS/bin
export G4ROOT=/usr/local
export G4ROOTMAKE=$G4ROOT/share/Geant4-10.6.0/geant4make
export G4WORKDIR=$HOME/home/andy/geant4
[ -f $G4ROOT/bin/ ] && . $G4ROOT/bin/
[ -f $G4ROOTMAKE/ ] && . $G4ROOTMAKE/

and .bashrc files:

export ROOTSYS=/usr/local:$ROOTSYS
export PATH=$ROOTSYS/bin:$PATH
export PATH=$PATH:/home/andy/geant4/bin
export PATH=$PATH:/home/andy/root/bin
export PATH=$PATH:/home/andy/Qt5.14.0
export PATH=$PATH:/home/andy/Qt5.14.0/Tools/QtCreator/bin
export PATH=$PATH:/home/andy/Qt5.14.0/Tools/QtCreator/lib/qtcreator
export PATH=$PATH:/usr/lib/x86_64-linux-gnu/
export PATH=$PATH:/home/andy/geant4/BuildProducts/lib/
export PATH

Well, i do not know … where is this file now -
Early it was in directory /home/andy/geant4/bin/ and i could run this command - source /home/andy/geant4/bin/
Now this file “” does not exist in this directory!
What must i do now? Help me!

1 Like

Can you confirm that you installed Geant4 in /usr/local and that the files /usr/local/bin/ and /usr/local/share/Geant4-10.6.0/geant4make/ are present please?

Sourcing these files should set LD_LIBRARY_PATH appropriately, and that should ensure that exampleB1 locates the required libraries appropriately. When you run:

andy@andy:~/geant/b1$ ./exampleB1

what is the value of LD_LIBRARY_PATH (i.e. result of echo $LD_LIBRARY_PATH)?

thank you very much your answer.
I installed geant4 to this directory: /home/andy/geant4

andy@andy:~$ ls /usr/local/bin/
apt geant4.csh gnome-help mint-sha256sum yelp
geant4-config highlight-mint search

andy@andy:~$ ls /usr/local/share/Geant4-10.6.0/geant4make/
config geant4make.csh

andy@andy:~$ ls /usr/local
bin etc games include lib man sbin share src

andy@andy:~$ echo $LD_LIBRARY_PATH

What files do you have under /home/andy/geant4? Did you configure your build of Geant4 with cmake -DCMAKE_INSTALL_PREFIX=/home/andy/geant4 <otherargs> and run make install after building it?

There’s certainly an install of Geant4 under /usr/local, and that’s the location being used to take from etc in the .bash_profile. Did you install Geant4 to /usr/local or is this coming from a system package? Is present anywhere under /usr/local?

There are several, likely conflicting, issues here. We first need to find out exactly where you want/expect Geant4 to be installed. That will allow use of the correct script to set LD_LIBRARY_PATH. The second is to check that LD_LIBRARY_PATH gets set correctly. The value:

andy@andy:~$ echo $LD_LIBRARY_PATH

is wrong as it does not contain the preceding value set in the .bash_profile call. Have you logged out of and back into this machine since editing .bash_profile? It’s usually only sourced on login, not starting new shells.

“What files do you have under /home/andy/geant4 ? Did you configure your build of Geant4 with cmake -DCMAKE_INSTALL_PREFIX=/home/andy/geant4 <otherargs> and run make install after building it?”
Yes, i built in this directory /home/andy/geant4
I used:
andy@andy:~$ cd /home/andy && makedir geant4 && cd geant4

P.S. At first, may be i must build geant4 in this directory: /usr/local/geant4 ?

There’s a difference in CMake between “build” and “install.” What you did in your CMake line is correct. That sets up all of the CMake rules and files you will need to do a build.

After that line, you should use make to do the building (compiling and linking in temporary directories), and then make install (to copy the temporary files to your CMAKE_INSTALL_PREFIX dirtectory.

yes, i used make and then make install:

makedir /home/andy/geant4 && cd geant4
sudo make -j4
sudo make install

but my problem remained

may be i must build geant4 in this directory: /usr/local/geant4 only?

No, you definitely do not have to install (not build!) to /usr/local. However, you do need to make sure that you are sourcing the correct file.

You should get rid of the /usr/local/geant4 entirely, unless you really want to install there. My preference tends to be to avoid putting “user level” stuff in /usr/local, unless I have to, but different people do different things.

With your current install to /home/andy/geant4, you should be sourcing /home/andy/geant4/bin/ That should set up your paths properly to run.

If you’re going to be building examples or applications using Make directly (i.e., not CMake), then you’ll source /home/andy/geant4/share/Geant4-10.6.0/geant4make/

methinks, i understood what is my error :

Are these parametres of geant4 true?
may be, is this parameter false: cmake_install_prefix = /home/andy/geant4 ?
methinks, it must be cmake_install_prefix = /user/local is this true?

Do you fix your problem? I have the same…

If the replies above don’t solve your issue, could you post details in a separate thread please?

thanks for your reply, I have fixed it by source ~/geant4.10.06.p02/bin/ before the step: cmake the examples.