I only installed global libraries of geant4, no granular libraries. GNUmakefile.db libG4materials.a libG4readout.so libG4digits_hits.a libG4materials.so libG4run.a libG4digits_hits.so libG4modeling.a libG4run.so libG4event.a libG4modeling.so libG4track.a libG4event.so libG4OpenGL.a libG4tracking.a libG4FR.a libG4OpenGL.so libG4tracking.so libG4FR.so libG4parmodels.a libG4track.so libG4geometry.a libG4parmodels.so libG4Tree.a libG4geometry.so libG4particles.a libG4Tree.so libG4global.a libG4particles.so libG4visHepRep.a libG4global.so libG4persistency.a libG4visHepRep.so libG4graphics_reps.a libG4persistency.so libG4vis_management.a libG4graphics_reps.so libG4processes.a libG4vis_management.so libG4intercoms.a libG4processes.so libG4visXXX.a libG4intercoms.so libG4RayTracer.a libG4visXXX.so libG4interfaces.a libG4RayTracer.so libG4VRML.a libG4interfaces.so libG4readout.a libG4VRML.so When I compile exampleN02, and run it, exampleN02: error while loading shared libraries libexampleN02.so: cannot open shared object file: No such file or directory This doesn't happen when I use granular libraries of Geant4. I know adding the location of libexampleN02.so to LD_LIBRARY_PATH can solve this problem. But when I run another example, I must change the LD_LIBRARY_PATH again! Now I have to unsetenv G4LIB_BUILD_SHARED when building examples.
Hello, The path to the shared library of the example is stored in the executable using the -Wl,-rpath option. Did you build the Geant4 libraries as shared libraries? The makefiles test for either libG4global.so or libG4globman.so to decide if you have shared libaries, and applies the -Wl,.. option only if you do have one of these two libraries. I did verify that example N02 works without having the directory containing the example shared library in the LD_LIBRARY_PATH. Hope this helps, Gunter