| Summary: | G4RUNPATHOPTION should have trailing comma for Clang and g++ configurations | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Michael Kelsey <kelsey> |
| Component: | config | Assignee: | Gabriele Cosmo <Gabriele.Cosmo> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P4 | ||
| Version: | 10.3 | ||
| Hardware: | Other | ||
| OS: | Linux | ||
Thanks for reporting this. The fix is now tagged config-V10-04-06 and will be included in the patch and/or release. Please, note that the GNUMake system is deprecated since long and only used for internal development. Consider switching your software to CMake, as GNUMake may soon be removed! |
One of my users reported to me that he wasn't able to run our Geant4-based simulation, and he couldn't run the G4 examples either. Building on his Mac using the GNUMakefile system, he got the following error, which I can reproduce: $ exampleB1 dyld: Library not loaded: @rpath/libG4Tree.dylib Referenced from: /Users/kelsey/geant4_workdir/bin/Darwin-clang/exampleB1 Reason: image not found Abort The problem arises because G4RUNPATHOPTION is not set correctly in the config/system/{Linux,Darwin}-{clang,g++}.gmk files. In those four files, the setting is G4RUNPATHOPTION := -Wl,-rpath which is later used in binmake.gmk as LDFLAGS += $(G4RUNPATHOPTION)$(G4TMPDIR) The option string needs to have a trailing comma, so that the directory is included in what gets passed to LD (i.e., -Wl,-rpath,<path-to-libraries> results in "-rpath <path-to-libraries>"). Additionally, binmake.gmk should use the G4RUNPATHOPTION construction above for both the executables own library ($(G4TMPDIR) above), and for the Geant4 main libraries; thus: LDFLAGS += $(G4RUNPATHOPTION)$(G4TMPDIR) LDFLAGS += $(G4RUNPATHOPTION)$(G4LIB)/$(G4SYSTEM) I was able to work around the problem by (a) modifying G4RUNPATHOPTION, and (b) adding the last line above, in my own application's GNUMakefile.