I use GEANT4 build with OpenInventor visualization enabled. Coin3d-3.1.3 serves a role of OpenInventor provider. Known Features: multithreading[no] clhep[yes] expat[no] zlib[yes] gdml[yes] usolids[no] g3tog4[no] qt[no] motif[no] raytracer-x11[no] opengl-x11[yes] openinventor[yes] I faced some problems compiling my program with G4UIterminal. I managed to reduce demonstation code to the following: [vbelov@rhel6-64l 4]$ cat test.sh #include "G4UIterminal.hh" #include "G4UItcsh.hh" G4UIterminal session(new G4UItcsh); int main() { return 0; } The compilation results with: [vbelov@rhel6-64l 4]$ g++ `geant4-config --cflags` test.cc -o test `geant4-config --libs-without-gui` /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtSetMappedWhenManaged' /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtRealizeWidget' /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtAppNextEvent' /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtDispatchEvent' /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtDisplay' /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtShellStrings' /afs/.../geant4.10.00.p04/rhel6-64/bin/../lib64/libG4interfaces.so: undefined reference to `XtAppInitialize' collect2: ld returned 1 exit status I see that undefined references come from libG4interfaces.so [vbelov@rhel6-64l lib64]$ ldd -r libG4interfaces.so undefined symbol: XtDispatchEvent (./libG4interfaces.so) undefined symbol: XtShellStrings (./libG4interfaces.so) undefined symbol: XtRealizeWidget (./libG4interfaces.so) undefined symbol: XtAppNextEvent (./libG4interfaces.so) undefined symbol: XtAppInitialize (./libG4interfaces.so) undefined symbol: XtDisplay (./libG4interfaces.so) undefined symbol: XtSetMappedWhenManaged (./libG4interfaces.so) linux-vdso.so.1 => (0x00007fffb73ff000) ... /lib64/ld-linux-x86-64.so.2 (0x00007f5810eb9000) If I disable OpenInventor everything works fine.
Unresolved symbols are from Xt library, so adding '-lXt' to library list solves the problem. Going deeper I found in cmake/Modules/Geant4InterfaceOptions.cmake lines related to this (see lines #187-243). In there one can see that Xt can be added to libraries list (#237) but this happens only for APPLE architecture: 233 # Create final list of X11 libraries needed for Geant4 234 # - Motif 235 if(APPLE) 236 if(GEANT4_USE_XM OR GEANT4_USE_INVENTOR) 237 set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xt_LIB}) 238 endif() 239 endif() I believe that confision comes from the fact that GNU ld doesn't care for any unresolved symbols when linking shared library. Contrary to Darwin linker which complains about anything. Removing this check fixes the situation. libG4interfaces.so gets new dependency on Xt and everything is fine. I didn't manage to test with 10.2, but is see mentioned lines unchanged there.
Created attachment 384 [details] proposed patch
Thanks for the report, and apologies for the delay. I'll apply the patch and update when it's passed testing.
The patch passed testing, so is now in the latest reference tag set, and will be in the next patch releases.