Can not run exampleB1

I could run B1 with ./exampleB1
but if press the button ‘‘run’’,error occurred like

source …install/share/Geant4-10.7.1/geant4make/geant4make.sh

can you give a more specific description?I didn’t khow much about it.
thanks!

is you mean ,i should ‘source geant4make.sh’ in geant4-install/share/Geant4-11.0.0/geant4mak?

it’s all here: Installation Guide — Geant4 Installation Guide 11.0 documentation

and specifically this: Postinstall Setup — Geant4 Installation Guide 11.0 documentation

I have installed great4 successfully.
and i can run B1 with command ./exampleB1
when press these 2 button,this error occurred.
image

Did you build exampleB1 with CMake from within this IDE (which one, out of interest)? CMake builds should use RPATH for builds so that linked libraries are found automatically. That can be checked using

$ ldd ./exampleB1

which should show all the linked libraries found, and

$ readelf -d ./exampleB1

which should contain RPATH or RUNPATH entries in the list.

If CMake isn’t being used, then the IDE would need to be configured to source the geant4.sh script before it runs exampleB1 so the LD_LIBRARY_PATH variable is set appropriately to allow the executable to locate the libraries.

list dynamic dependencies


but when readelf -d ./exampleB,libG4graphics_reps.so isn’t here.

O.k., could you post the output of

$ readelf -d ./exampleB1

here please? It’s better if this is copied from the terminal and pasted using a fenced code block, e.g.

```
type or paste code between triple backpacks
```

This is much easier and more readable than a screenshot.

geant4@geant4:~/geant4/examples/basic/B1/build$ readelf -d ./exampleB1

Dynamic section at offset 0x146a8 contains 54 entries:
  标记        类型                         名称/值
 0x0000000000000001 (NEEDED)             共享库:[libG4Tree.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4FR.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4GMocren.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4visHepRep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4RayTracer.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4VRML.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4OpenGL.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4vis_management.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4modeling.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4interfaces.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4physicslists.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tasking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4run.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4event.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tracking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4analysis.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4particles.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4geometry.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4materials.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4intercoms.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4global.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4clhep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4ptl.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libm.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/opt/geant4/geant4-install/lib:/usr/local/lib:]
 0x000000000000000c (INIT)               0x7000
 0x000000000000000d (FINI)               0x10178
 0x0000000000000019 (INIT_ARRAY)         0x15158
 0x000000000000001b (INIT_ARRAYSZ)       88 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x151b0
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x3d8
 0x0000000000000005 (STRTAB)             0x1ba0
 0x0000000000000006 (SYMTAB)             0x490
 0x000000000000000a (STRSZ)              10575 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x15a48
 0x0000000000000002 (PLTRELSZ)           3816 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x5890
 0x0000000000000007 (RELA)               0x47e0
 0x0000000000000008 (RELASZ)             4272 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            标志: NOW PIE
 0x000000006ffffffe (VERNEED)            0x46e0
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x44f0
 0x000000006ffffff9 (RELACOUNT)          91
 0x0000000000000000 (NULL)               0x0
geant4@geant4:~/geant4/examples/basic/B1/build$ readelf -d ./exampleB1

Dynamic section at offset 0x146a8 contains 54 entries:
  标记        类型                         名称/值
 0x0000000000000001 (NEEDED)             共享库:[libG4Tree.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4FR.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4GMocren.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4visHepRep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4RayTracer.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4VRML.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4OpenGL.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4vis_management.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4modeling.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4interfaces.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4physicslists.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tasking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4run.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4event.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tracking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4analysis.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4particles.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4geometry.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4materials.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4intercoms.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4global.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4clhep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4ptl.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libm.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/opt/geant4/geant4-install/lib:/usr/local/lib:]
 0x000000000000000c (INIT)               0x7000
 0x000000000000000d (FINI)               0x10178
 0x0000000000000019 (INIT_ARRAY)         0x15158
 0x000000000000001b (INIT_ARRAYSZ)       88 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x151b0
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x3d8
 0x0000000000000005 (STRTAB)             0x1ba0
 0x0000000000000006 (SYMTAB)             0x490
 0x000000000000000a (STRSZ)              10575 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x15a48
 0x0000000000000002 (PLTRELSZ)           3816 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x5890
 0x0000000000000007 (RELA)               0x47e0
 0x0000000000000008 (RELASZ)             4272 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            标志: NOW PIE
 0x000000006ffffffe (VERNEED)            0x46e0
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x44f0
 0x000000006ffffff9 (RELACOUNT)          91
 0x0000000000000000 (NULL)               0x0

Thanks for the info! The RUNPATH here is set, so all should be fine. All I can spot is that in the first post, the application being run is at path:

/home/geant4/geant4/examples/basic/B1/cmake-build-debug/exampleB1

whilst the one being checked by readelf is

/home/geant4/geant4/examples/basic/B1/build/exampleB1

Could you run readelf on the

/home/geant4/geant4/examples/basic/B1/cmake-build-debug/exampleB1

and post the output here please (and is this the one you expect/want to be run?)?

It looks like this is in the CLion IDE?

thanks for your answer!!!
and here is the info by readelf on cmake build debug

geant4@geant4:~/geant4/examples/basic/B1/cmake-build-debug$ readelf -d ./exampleB1

Dynamic section at offset 0x1d6c0 contains 54 entries:
  标记        类型                         名称/值
 0x0000000000000001 (NEEDED)             共享库:[libG4Tree.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4FR.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4GMocren.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4visHepRep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4RayTracer.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4VRML.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4OpenGL.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4vis_management.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4modeling.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4interfaces.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4physicslists.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tasking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4run.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4event.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tracking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4analysis.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4particles.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4geometry.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4materials.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4intercoms.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4global.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4clhep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4ptl.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libm.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/opt/geant4/geant4-install/lib:/usr/local/lib:]
 0x000000000000000c (INIT)               0x7000
 0x000000000000000d (FINI)               0x13888
 0x0000000000000019 (INIT_ARRAY)         0x1e170
 0x000000000000001b (INIT_ARRAYSZ)       88 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x1e1c8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x3d8
 0x0000000000000005 (STRTAB)             0x1cf8
 0x0000000000000006 (SYMTAB)             0x4c8
 0x000000000000000a (STRSZ)              11398 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x1ea60
 0x0000000000000002 (PLTRELSZ)           4008 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x5c10
 0x0000000000000007 (RELA)               0x4c68
 0x0000000000000008 (RELASZ)             4008 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            标志: NOW PIE
 0x000000006ffffffe (VERNEED)            0x4b88
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x497e
 0x000000006ffffff9 (RELACOUNT)          87
 0x0000000000000000 (NULL)               0x0

thanks for your answer!!!
and here is the info by readelf on cmake build debug

geant4@geant4:~/geant4/examples/basic/B1/cmake-build-debug$ readelf -d ./exampleB1

Dynamic section at offset 0x1d6c0 contains 54 entries:
  标记        类型                         名称/值
 0x0000000000000001 (NEEDED)             共享库:[libG4Tree.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4FR.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4GMocren.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4visHepRep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4RayTracer.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4VRML.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4OpenGL.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4vis_management.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4modeling.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4interfaces.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4physicslists.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tasking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4run.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4event.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4tracking.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4analysis.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4particles.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4geometry.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4materials.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4intercoms.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4global.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4clhep.so]
 0x0000000000000001 (NEEDED)             共享库:[libG4ptl.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libm.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/opt/geant4/geant4-install/lib:/usr/local/lib:]
 0x000000000000000c (INIT)               0x7000
 0x000000000000000d (FINI)               0x13888
 0x0000000000000019 (INIT_ARRAY)         0x1e170
 0x000000000000001b (INIT_ARRAYSZ)       88 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x1e1c8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x3d8
 0x0000000000000005 (STRTAB)             0x1cf8
 0x0000000000000006 (SYMTAB)             0x4c8
 0x000000000000000a (STRSZ)              11398 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x1ea60
 0x0000000000000002 (PLTRELSZ)           4008 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x5c10
 0x0000000000000007 (RELA)               0x4c68
 0x0000000000000008 (RELASZ)             4008 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            标志: NOW PIE
 0x000000006ffffffe (VERNEED)            0x4b88
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x497e
 0x000000006ffffff9 (RELACOUNT)          87
 0x0000000000000000 (NULL)               0x0

Apologies for the delay in replying - afraid I’m at a bit of a loss here. The RUNPATH looks to be set correctly, and if ~/geant4/examples/basic/B1/cmake-build-debug/exampleB1 can be run from the command line, then there’s no reason I know of that would prevent the IDE running this. I’m guessing this is some settings issue in the IDE, but I’m not familiar with it (CLion?) so can’t offer any guidance other than to ask on any fora/discussions its community has.

If you find a solution though, please feedback here!

thank you very much for your answer!
yes, I use CLION.Maybe as you guessed,some setting wrong

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