OpenGL Library and G4 10.6

I’ve still fairly new to Geant4 overall, only a few months of experience with version 10.5. I have been and am working on Geant4 with a Ubuntu system. When I was first trying to compile I had a few issues with getting visualization to work, but after many attempts I had Geant4 10.5 with OGL and Dawnfile. Before 10.6 came out I wrote myself notes on compilation, hoping the notes would help me compile correctly.
The settings I had on for cmake were:
“-DGeant4_INSTALL_DATA=ON”
“-DGeant4_USE_OPENGL_X11=ON”
“-DGeant4_USE_QT=ON”
I also was trying “-DGeant4_BUILD_MULTITHREADED=ON” but stopped since I wasn’t confident it was needed.
Before attempting to compile 10.6 I compressed my old Geant4 (10.5.01) and deleted the none compressed files. So I could go back to a working version of Geant4 but I need the new G4ParticleXS.2.1 file for certain low/medium energy proton simulations.

After 10.6 released I have NOT been able to compile and run examples without issues.
I’m having issues with libG4OpenGL.so but no other visualization issues.

When running example B1, or any example using OGL, the example crashes and prints:

“./exampleB1 symbol lookup error: /home/jason/Geant4/geant4-install/lib/libG4OpenGL.so: undefined symbol: _ZTI6G4UIQt”

It was referencing "/usr/lib/x86_64-linux-gnu/libOpenGL.so " before I tried to mess with that file and it started referencing the file in my install directory. I tried to put the files back to the way they were in /usr/ but it hasn’t been referenced since I messed with them.

When swapping the libG4OpenGL.so file, from the one created by cake to file from the pre-compiled library provided by CERN on the Geant4 site, the program prints:
“./exampleB1: symbol lookup error: ./exampleB1: undefined symbol: _ZN19G4OpenGLImmediateQtC1Ev”
I haven’t been able to find anything to do with those symbols online, and I’ve only found very little on symbol lookup error/undefined symbol.

I’m fairly sure I downloaded and installed OGL correctly, because I used a basic example outside of Geant4 that worked. Also I checked “glxinfo | grep direct” and it output “Yes”.
But when I run an modified version of TestEm7 that uses Dawnfile visualization, it runs perfectly fine but it does not list OGL as an available graphics system. I’m not sure exactly why my TestEm7 works, because when I attempt to change the visualization of other example to be Dawnfile from OGL it still crashes.

I think there is some issue with the linking of my library in Geant4.
I’ve tried deleting and recompiling Geant4 many times now and with different settings nothing I’ve tried has worked so far.
There could be some traces of my old Geant4-10.5.01 causing problems but I tried to delete the files I could.

Any help would be greatly appreciated, I’ve been struggling with this since 10.6 released!
-Sincerely Jason

First, could you confirm which version of Ubuntu this is and the GCC version please? Also, what exactly did you do with /usr/lib/x86_64-linux-gnu/libOpenGL.so"? That’s a system file totally unrelated to Geant4.

The missing symbols come from the G4interfaces (G4UIQt) and G4OpenGL (G4OpenGLImmediateQt), so could you run:

$ ldd ./exampleB1

followed by

$ readelf -d ./exampleB1

and post the output here please?

These will just check what the example executable is linked to so we can check that’s o.k.

Then run the same commands, but on /home/jason/Geant4/geant4-install/lib/libG4OpenGL.so, and post the output here.

Please also try running exampleB1 as follows:

$ LD_LIBRARY_PATH=/home/jason/Geant4/geant4-install/lib/ ./exampleB1

and see if this resolves the problem. I suspect an issue with the default linking behaviour on Ubuntu.

I am using a Ubuntu virtual machine running LXQt version 0.14.1, or Ubuntu 19.04?
With GCC version: 8.3.0
I naively moved the libOpenGL.so out of /usr/ thinking it was attached to Geant4 but once I realized it wasn’t and I moved the files back to /usr/lib/x86_64-linux-gnu.
I just got to work and tried to start up my virtual machine of Ubuntu. Im fairly sure me moving those files messed with the Virtual Machine because now its not working they way it was before (just command line not UI). I could navigate through folders and I even got to trying the ldd but most of the result got cut off screen and there is no scroll. So I’m going to go back on an old snapshot and rebuild Geant4 version 10.6. I will get back to you on what you said to run when its built!

Input: “ldd ./exampleB1”
Output:

linux-vdso.so.1 (0x00007ffef15eb000)
libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f38ef218000)
libG4Tree.so => /usr/local/lib/libG4Tree.so (0x00007f38ef200000)
libG4GMocren.so => /usr/local/lib/libG4GMocren.so (0x00007f38ef1b8000)
libG4visHepRep.so => /usr/local/lib/libG4visHepRep.so (0x00007f38ef120000)
libG4RayTracer.so => /usr/local/lib/libG4RayTracer.so (0x00007f38ef0f0000)
libG4VRML.so => /usr/local/lib/libG4VRML.so (0x00007f38ef0d0000)
libG4OpenGL.so => /home/jason/Geant4/geant4-install/lib/libG4OpenGL.so (0x00007f38ef038000)
libG4interfaces.so => /usr/local/lib/libG4interfaces.so (0x00007f38eefe0000)
libG4physicslists.so => /usr/local/lib/libG4physicslists.so (0x00007f38eee38000)
libG4FR.so => /usr/local/lib/libG4FR.so (0x00007f38eee20000)
libG4vis_management.so => /usr/local/lib/libG4vis_management.so (0x00007f38eed20000)
libG4modeling.so => /usr/local/lib/libG4modeling.so (0x00007f38eec28000)
libG4run.so => /usr/local/lib/libG4run.so (0x00007f38eeb98000)
libG4event.so => /usr/local/lib/libG4event.so (0x00007f38eeb18000)
libG4tracking.so => /usr/local/lib/libG4tracking.so (0x00007f38eeac8000)
libG4analysis.so => /usr/local/lib/libG4analysis.so (0x00007f38ee650000)
libG4particles.so => /usr/local/lib/libG4particles.so (0x00007f38ee530000)
libG4geometry.so => /usr/local/lib/libG4geometry.so (0x00007f38ee258000)
libG4materials.so => /usr/local/lib/libG4materials.so (0x00007f38ee180000)
libG4intercoms.so => /usr/local/lib/libG4intercoms.so (0x00007f38ee110000)
libG4global.so => /usr/local/lib/libG4global.so (0x00007f38ee0b0000)
libG4clhep.so => /usr/local/lib/libG4clhep.so (0x00007f38ee010000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f38ede28000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f38ede08000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f38edc18000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f38edc10000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f38edbe8000)
libG4graphics_reps.so => /usr/local/lib/libG4graphics_reps.so (0x00007f38edba0000)
libG4digits_hits.so => /usr/local/lib/libG4digits_hits.so (0x00007f38edad8000)
libG4zlib.so => /usr/local/lib/libG4zlib.so (0x00007f38edab8000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f38ed968000)
libG4processes.so => /usr/local/lib/libG4processes.so (0x00007f38e9670000)
libG4gl2ps.so => /usr/local/lib/libG4gl2ps.so (0x00007f38e9458000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f38e93c0000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f38e9280000)
libXmu.so.6 => /lib/x86_64-linux-gnu/libXmu.so.6 (0x00007f38e9060000)
libQt5OpenGL.so.5 => /lib/x86_64-linux-gnu/libQt5OpenGL.so.5 (0x00007f38e9000000)
libQt5Widgets.so.5 => /lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007f38e8998000)
libQt5Gui.so.5 => /lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f38e83e8000)
libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f38e7ec0000)
libG4track.so => /usr/local/lib/libG4track.so (0x00007f38e7e98000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f38e7e58000)
/lib64/ld-linux-x86-64.so.2 (0x00007f38ef458000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f38e7e20000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f38e7d60000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f38e7d30000)
libXt.so.6 => /lib/x86_64-linux-gnu/libXt.so.6 (0x00007f38e7ac0000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f38e78a8000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f38e7870000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f38e7850000)
libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f38e7750000)
libicui18n.so.63 => /lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f38e7470000)
libicuuc.so.63 => /lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f38e72a0000)
libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007f38e7220000)
libdouble-conversion.so.1 => /lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007f38e7208000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f38e70e0000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f38e6ed8000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f38e6cd0000)
libSM.so.6 => /lib/x86_64-linux-gnu/libSM.so.6 (0x00007f38e6cc0000)
libICE.so.6 => /lib/x86_64-linux-gnu/libICE.so.6 (0x00007f38e6aa0000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f38e69e0000)
libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f38e69b0000)
libicudata.so.63 => /lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f38e4fc0000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f38e4f48000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f38e4f28000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f38e4f18000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f38e4f08000)

Input: “readelf -d ./exampleB1”
Output:

Dynamic section at offset 0xd7f0 contains 51 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libG4Tree.so]
0x0000000000000001 (NEEDED) Shared library: [libG4GMocren.so]
0x0000000000000001 (NEEDED) Shared library: [libG4visHepRep.so]
0x0000000000000001 (NEEDED) Shared library: [libG4RayTracer.so]
0x0000000000000001 (NEEDED) Shared library: [libG4VRML.so]
0x0000000000000001 (NEEDED) Shared library: [libG4OpenGL.so]
0x0000000000000001 (NEEDED) Shared library: [libG4interfaces.so]
0x0000000000000001 (NEEDED) Shared library: [libG4physicslists.so]
0x0000000000000001 (NEEDED) Shared library: [libG4FR.so]
0x0000000000000001 (NEEDED) Shared library: [libG4vis_management.so]
0x0000000000000001 (NEEDED) Shared library: [libG4modeling.so]
0x0000000000000001 (NEEDED) Shared library: [libG4run.so]
0x0000000000000001 (NEEDED) Shared library: [libG4event.so]
0x0000000000000001 (NEEDED) Shared library: [libG4tracking.so]
0x0000000000000001 (NEEDED) Shared library: [libG4analysis.so]
0x0000000000000001 (NEEDED) Shared library: [libG4particles.so]
0x0000000000000001 (NEEDED) Shared library: [libG4geometry.so]
0x0000000000000001 (NEEDED) Shared library: [libG4materials.so]
0x0000000000000001 (NEEDED) Shared library: [libG4intercoms.so]
0x0000000000000001 (NEEDED) Shared library: [libG4global.so]
0x0000000000000001 (NEEDED) Shared library: [libG4clhep.so]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000001d (RUNPATH) Library runpath: [/home/jason/Geant4/geant4-install/lib:]
0x000000000000000c (INIT) 0x6000
0x000000000000000d (FINI) 0xa964
0x0000000000000019 (INIT_ARRAY) 0xe3c0
0x000000000000001b (INIT_ARRAYSZ) 64 (bytes)
0x000000000000001a (FINI_ARRAY) 0xe400
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x308
0x0000000000000005 (STRTAB) 0x1558
0x0000000000000006 (SYMTAB) 0x358
0x000000000000000a (STRSZ) 8172 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000015 (DEBUG) 0x0
0x0000000000000003 (PLTGOT) 0xeb60
0x0000000000000002 (PLTRELSZ) 2880 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x45a8
0x0000000000000007 (RELA) 0x3798
0x0000000000000008 (RELASZ) 3600 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000000000001e (FLAGS) BIND_NOW
0x000000006ffffffb (FLAGS_1) Flags: NOW PIE
0x000000006ffffffe (VERNEED) 0x36c8
0x000000006fffffff (VERNEEDNUM) 3
0x000000006ffffff0 (VERSYM) 0x3544
0x000000006ffffff9 (RELACOUNT) 76
0x0000000000000000 (NULL) 0x0

Input: ldd libG4OpenGL.so
Output:

linux-vdso.so.1 (0x00007ffe8b5b3000)
libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f454abb8000)
libG4gl2ps.so => /usr/local/lib/libG4gl2ps.so (0x00007f454a9a0000)
libG4interfaces.so => /usr/local/lib/libG4interfaces.so (0x00007f454a948000)
libG4vis_management.so => /usr/local/lib/libG4vis_management.so (0x00007f454a848000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f454a7b0000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f454a670000)
libXmu.so.6 => /lib/x86_64-linux-gnu/libXmu.so.6 (0x00007f454a450000)
libQt5OpenGL.so.5 => /lib/x86_64-linux-gnu/libQt5OpenGL.so.5 (0x00007f454a3f0000)
libQt5Widgets.so.5 => /lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007f4549d88000)
libG4modeling.so => /usr/local/lib/libG4modeling.so (0x00007f4549c90000)
libG4run.so => /usr/local/lib/libG4run.so (0x00007f4549c00000)
libG4geometry.so => /usr/local/lib/libG4geometry.so (0x00007f4549928000)
libG4graphics_reps.so => /usr/local/lib/libG4graphics_reps.so (0x00007f45498e0000)
libG4intercoms.so => /usr/local/lib/libG4intercoms.so (0x00007f4549870000)
libG4global.so => /usr/local/lib/libG4global.so (0x00007f4549810000)
libG4clhep.so => /usr/local/lib/libG4clhep.so (0x00007f4549770000)
libQt5Gui.so.5 => /lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f45491c0000)
libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f4548c98000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4548ab0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4548960000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4548940000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4548750000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4548748000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4548720000)
libG4zlib.so => /usr/local/lib/libG4zlib.so (0x00007f4548700000)
libG4event.so => /usr/local/lib/libG4event.so (0x00007f4548680000)
libG4tracking.so => /usr/local/lib/libG4tracking.so (0x00007f4548630000)
libG4digits_hits.so => /usr/local/lib/libG4digits_hits.so (0x00007f4548568000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f4548530000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f4548470000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f4548440000)
libXt.so.6 => /lib/x86_64-linux-gnu/libXt.so.6 (0x00007f45481d0000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f4547fb8000)
libG4processes.so => /usr/local/lib/libG4processes.so (0x00007f4543cc0000)
libG4particles.so => /usr/local/lib/libG4particles.so (0x00007f4543ba0000)
libG4materials.so => /usr/local/lib/libG4materials.so (0x00007f4543ac8000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f4543a90000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f4543a70000)
libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f4543970000)
libicui18n.so.63 => /lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f4543690000)
libicuuc.so.63 => /lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f45434c0000)
libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007f4543440000)
libdouble-conversion.so.1 => /lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007f4543428000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f4543300000)
/lib64/ld-linux-x86-64.so.2 (0x00007f454ae80000)
libG4track.so => /usr/local/lib/libG4track.so (0x00007f45432d8000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f45430d0000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f4542ec8000)
libSM.so.6 => /lib/x86_64-linux-gnu/libSM.so.6 (0x00007f4542eb8000)
libICE.so.6 => /lib/x86_64-linux-gnu/libICE.so.6 (0x00007f4542c98000)
libG4analysis.so => /usr/local/lib/libG4analysis.so (0x00007f4542820000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f45427e0000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f4542720000)
libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f45426f0000)
libicudata.so.63 => /lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f4540d00000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f4540c88000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f4540c68000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f4540c58000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4540c48000)

Input: readelf -d libG4OpenGL.so
Output:

Dynamic section at offset 0x8b990 contains 45 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libG4gl2ps.so]
0x0000000000000001 (NEEDED) Shared library: [libG4interfaces.so]
0x0000000000000001 (NEEDED) Shared library: [libG4vis_management.so]
0x0000000000000001 (NEEDED) Shared library: [libGL.so.1]
0x0000000000000001 (NEEDED) Shared library: [libX11.so.6]
0x0000000000000001 (NEEDED) Shared library: [libXmu.so.6]
0x0000000000000001 (NEEDED) Shared library: [libQt5OpenGL.so.5]
0x0000000000000001 (NEEDED) Shared library: [libQt5Widgets.so.5]
0x0000000000000001 (NEEDED) Shared library: [libG4modeling.so]
0x0000000000000001 (NEEDED) Shared library: [libG4run.so]
0x0000000000000001 (NEEDED) Shared library: [libG4geometry.so]
0x0000000000000001 (NEEDED) Shared library: [libG4graphics_reps.so]
0x0000000000000001 (NEEDED) Shared library: [libG4intercoms.so]
0x0000000000000001 (NEEDED) Shared library: [libG4global.so]
0x0000000000000001 (NEEDED) Shared library: [libG4clhep.so]
0x0000000000000001 (NEEDED) Shared library: [libQt5Gui.so.5]
0x0000000000000001 (NEEDED) Shared library: [libQt5Core.so.5]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname: [libG4OpenGL.so]
0x000000000000000c (INIT) 0x2a000
0x000000000000000d (FINI) 0x71824
0x0000000000000019 (INIT_ARRAY) 0x88b28
0x000000000000001b (INIT_ARRAYSZ) 208 (bytes)
0x000000000000001a (FINI_ARRAY) 0x88bf8
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x260
0x0000000000000005 (STRTAB) 0xa938
0x0000000000000006 (SYMTAB) 0x1ad0
0x000000000000000a (STRSZ) 63388 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0x8d000
0x0000000000000002 (PLTRELSZ) 22008 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x243a0
0x0000000000000007 (RELA) 0x1ae48
0x0000000000000008 (RELASZ) 38232 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x1acb8
0x000000006fffffff (VERNEEDNUM) 8
0x000000006ffffff0 (VERSYM) 0x1a0d4
0x000000006ffffff9 (RELACOUNT) 221
0x0000000000000000 (NULL) 0x0

So I tried “LD_LIBRARY_PATH=/home/jason/Geant4/geant4-install/lib/ ./exampleB1” and it just worked like that. I’m confused as to why the visualization works this way.
So do I have the library path linked wrong? Is it possible to correct the link or will I need to specify the path every time?

I seriously appreciate the help you’ve provided so far!
-Sincerely Jason

Thanks for the info! It looks like you have two installs of Geant4, one in /usr/local, and one under /home/jason/Geant4/geant4-install/. It’s likely that’s causing the issue, but, I’m not sure why the build picked up a mix of the two.

Do you have a full set of libraries/headers under /home/jason/Geant4/geant4-install/, and how did you configure and build the example? Did you install the version under /usr/local or is it coming from a system package?

Oh no I was worried I didn’t remove the old version of Geant correctly. I couldn’t find much information on upgrading versions so I assumed it wasn’t that complicated.
I’m not sure how to know if I have a full set of libraries/headers in my install directory, but I do have all the libraries that are in the pre-compiled library.

I configured exampleB1 as simply as I could. I took B1 from the downloaded Geant4 file (/home/jason/Geant4/geant4.10.06/examples/basic/B1)
I created a B1-build directory, opened that directory.
Then I input:

“cmake -DGeant4_DIR=/home/jason/Geant4/geant4-install/lib/Geant4-10.6.0 /home/jason/Geant4/geant4.10.06/examples/basic/B1”

then, because the PC has 3 cores,

“make -j3”

and finally

“make install”

I don’t know if this information will be helpful since you have already determined I have two Geant4 versions, but in /usr/ there are these two files.

/usr/local/share/Geant4-10.5.1
/usr/local/lib/Geant4-10.5.1

Also there is not Geant4-10.6 anywhere in my /usr/local/
Should I try to remove any traces of 10.5 that I see and recompile?
or Would you recommend something else to fix this linking issue?

No, that’s helpful, as I think what’s happening is that your build of exampleB1 is fine and has RUNPATH set (see the output of readelf -d exampleB1), but the installed Geant4 libraries don’t.

When exampleB1 runs, I think it’s finding the libraries in /home/jason/Geant4/geant4-install/lib fine, but when those libraries try and load their dependencies, they are picked up from /usr/local/lib because they don’t have RUNPATH set, and thus fall back to the system locations.

This would explain why setting LD_LIBRARY_PATH works at it overrides all of these settings. So, you don’t need to remove that system install unless you want to, but to get exampleB1 with the 10.6 install running you’ll need to either:

  1. Set LD_LIBRARY_PATH when running (the geant4.sh script that should be installed in /home/jason/Geant4/geant4-install/bin can do this for you)
  2. Configure Geant4 with the option -DCMAKE_INSTALL_RPATH=/home/jason/Geant4/geant4-install/lib in addition to the others. Then reinstall. That should set RUNPATH on the libraries themselves.

There’s an old, but accurate, post about these details on the linux linker/loader here: https://www.qt.io/blog/2011/10/28/rpath-and-runpath

1 Like

So I attempted the 2nd option you listed. I went into the build directory and reconfigured Geant4 with that RUNPATH and installed so that all libraries are going to

/home/jason/Geant4/geant4-install/lib

Then when I tried example B1 again it failed and I got the same error as before.
I will attempt the first option you listed but I’m confused why the 2nd option didn’t work. Is there still linkage to the old Geant4?

The RUNPATH was changed from be specified to a particular library to just the lib folder.

– Installing: /home/jason/Geant4/geant4-install/lib/libG4modeling.so
– Set runtime path of “/home/jason/Geant4/geant4-install/lib/libG4modeling.so” to “/home/jason/Geant4/geant4-install/lib”
– Installing: /home/jason/Geant4/geant4-install/lib/libG4OpenGL.so
– Set runtime path of “/home/jason/Geant4/geant4-install/lib/libG4OpenGL.so” to “/home/jason/Geant4/geant4-install/lib”

After doing the first option you suggested the visualization of B1 works fine.
I will just have to override the library path through

geant4.sh

As long as I have a working Geant4 with visualization, I’m happy. I’m still confused why the 2nd option you suggested didn’t work but if that shouldn’t effect simulation results and stuff, it doesn’t matter. I just want to make sure I’m not messing up how Geant4 works by specifying the library path.

Genuinely, Thank you so much! I was struggling to figure out this issue for a few days and it slowed my work a lot. I appreciate all of your guidance in fixing this issue, I would still be stuck with a nonfunctioning Geant4 without your help.
-Sincerely Jason