Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Deploying on linux, executable cannot find shared library at runtime?



  • I have developed an application that works on Windows and I am working on getting it working on Linux. I have been able to link the libraries during compilation but I am unable to get them to work at runtime.

    I have looked everyone on the internet and I have implemented what I believe is the correct approach but unfortunately it does not seem to work no matter what I try.

    when running ldd on the binary It shows that it cannot find the libraries despite changing the location for which it should be looking.

    linux-vdso.so.1 => (0x00007fff757f5000)
    libopensslwrap.so.1 => not found
    libQt5Widgets.so.5 => /usr/lib64/libQt5Widgets.so.5 (0x00000038b8e00000)
    libQt5Network.so.5 => /usr/lib64/libQt5Network.so.5 (0x00000038b4e00000)
    libQt5Xml.so.5 => /usr/lib64/libQt5Xml.so.5 (0x00007f76a89ee000)
    libQt5Gui.so.5 => /usr/lib64/libQt5Gui.so.5 (0x00000038b7600000)
    libQt5Core.so.5 => /usr/lib64/libQt5Core.so.5 (0x00000038b6e00000)
    libicudata.so.52 => not found
    libicui18n.so.52 => not found
    libicuio.so.52 => not found
    libicule.so.52 => not found
    libiculx.so.52 => not found
    libicutest.so.52 => not found
    libicutu.so.52 => not found
    libicuuc.so.52 => not found
    libcrypto-1_0_2.so.1.0.2 => not found
    libssl-1_0_2.so.1.0.2 => not found
    libGL.so.1 => /usr/lib64/libGL.so.1 (0x00000038c0200000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00000038b2a00000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000038bd200000)

    I have implemented this in my project file but unfortunately It does not do anything.

    path/to/project/bin <- where the binary is.
    path/to/project/lib <- where the library files are.

    linux {
    QMAKE_LFLAGS_RPATH =
    QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN/../lib\''
    }

    Can anyone work out what I have done wrong?


  • Qt Champions 2019


  • Lifetime Qt Champion

    Hi,

    You can use a qt.conf file to say where the libraries are.

    For testing purpose, another way is to set the LD_LIBRARY_PATH environment variable to the path where the .libraries can be found.



  • Did you tried to use QMAKE_RPATHDIR that doesn't need to explicitly set compiler flags ??
    https://doc.qt.io/qt-5/qmake-variable-reference.html#qmake-rpathdir

    Also, did you try to run "readelf -d <binary>" to see if the RPATH has been correctly configured into the application binary ??


Log in to reply