Example G01 error while loading shared libraries: libQt5OpenGL.so.5


I have installed Geant4 (v10.7.4) on my Debian 12 laptop. When I run example G01 I get an error which goes like:

“error while loading shared libraries: libQt5OpenGL.so.5: cannot open shared object file: No such file or directory”

I have run ldd on the load_gdml executable and see the following line:

“libQt5OpenGL.so.5 => not found”

as expected. The strange thing is it has found the following:

“libQt5Gui.so.5 => /lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007fe6b5e00000)
libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fe6b5800000)”

i.e. under the system files. I find this strange because I installed geant4 against my local copy of Qt5 in my home directory where you can find these libraries under:


so I was expecting it to find the relevant shared Qt5 libraries here.

Any ideas of what I can try to resolve this?

Thank you!

Geant4 Version:v10.7.4
Operating System: Debian 12
Compiler/Version: gcc 12.2.0
CMake Version: 3.25.1

Is the load_gdml executable installed, or are you running it from where you built it? If the former, then it’s not going to find libraries in locations like /home/richard/Qt5.12.12/5.12.12/gcc_64/lib/cmake. If you want it to do that, you’ll need to configure the application with -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON. See also the CMake Wiki on RPATH handling, which is old, but still relevant.

As an aside, Debian 12 provides system packages for Qt5 5.15, so I’d recommend using those unless you have very specific reasons to not do so.

Hi @bmorgan,

I am running the executable load_gdml.sh from ~/g4work/G01/build.

A while ago, when I was installing geant4.v10.7.4 I had problems getting it to see the correct Qt5 system libraries which is why I opted for a local install of Qt5.12.12. This may be the source of my problems i.e. clashing versions between system and local files?

What does readelf -d load_gdml print? Nominally Cmake should add the full rpath to needed libraries, and a Geant4 install should be providing those on the link line. Could you also rebuild G01 from scratch and run make VERBOSE=1 (or ninja -v if you use Ninja) and post the output of the final link command please?

Hi @bmorgan,

Thank you for your attention. Before you sent your last message, I removed my local copy of Qt in my home drive and made sure that I had all the prerequisite library files for Qt in their system locations.

I then re-installed Geant4 and now G01 works fine.

Again thanks!

1 Like

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