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: libG4graphics_reps.so: cannot open shared object file: No such file or directory "
next my command:
" andy@andy:~/geant/b1$ ldd exampleB1 | grep libG4graphics
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4digits_hits.so => not found
libG4graphics_reps.so => not found
libG4graphics_reps.so => not found
libG4zlib.so => not found
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f7d2216c000)
libG4processes.so => not found
libG4digits_hits.so => not found
libG4graphics_reps.so => not found "
and this command:
" andy@andy:~/geant/b1$ locate libG4graphics_reps.so
/home/andy/.local/share/Trash/files/geant4/BuildProducts/lib/libG4graphics_reps.so
/home/andy/geant4/BuildProducts/lib/libG4graphics_reps.so "
Well, i do not know … where is this file now - geant4.sh?
Early it was in directory /home/andy/geant4/bin/ and i could run this command - source /home/andy/geant4/bin/geant4.sh
Now this file “geant4.sh” does not exist in this directory!
What must i do now? Help me!
Can you confirm that you installed Geant4 in /usr/local and that the files /usr/local/bin/geant4.sh and /usr/local/share/Geant4-10.6.0/geant4make/geant4make.sh 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)?
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 geant4.sh from etc in the .bash_profile. Did you install Geant4 to /usr/local or is this coming from a system package? Is libG4graphics_reps.so 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:
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
cmake -DCMAKE_INSTALL_PREFIX=/home/andy/geant4 /home/andy/geant4_10_06 -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON
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.
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 geant4.sh 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/geant4.sh. 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/geant4make.sh.
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?
Thank you very mash for you post!
Your answer resolved my problem and i have made B1-example!
My troubles was in this geant4-path, because i used this path in my bashrc:
source /opt/geant4/geant4_10_07_p03-install/share/Geant4-10.7.3/geant4make/geant4make.sh
but i need using this path:
source /opt/geant4/geant4_10_07_p03-install/bin/geant4.sh
and it is all right now.
by the way this error:
" CMake Error at CMakeLists.txt:37 (add_executable):
Target “exampleB1” links to target “Qt4::QtGui” but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:37 (add_executable):
Target “exampleB1” links to target “Qt4::QtCore” but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:37 (add_executable):
Target “exampleB1” links to target “Qt4::QtOpenGL” but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:37 (add_executable):
Target “exampleB1” links to target “Qt4::QtGui” but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
– Generating done
– Build files have been written to: /opt/geant4/example/B1 "
also it has been resolved using correct geant-path in bashrc writting above: bin/geant4.sh in place of geant4make.sh