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

How can I specify the path for the linker ?



  • Hi, I compiled my program and run it in QtCreator with no issues, yet when I run it from the terminal, it's looking for Qt libraries in /usr/lib/x86_64-linux-gnu/, where they are not.
    I had to run LD_LIBRARY_PATH=/home/"user"/Qt/5.12.2/gcc_64/lib ./a.out and it would run.
    (off topic note: after having done this once, I can just run ./a.out and it finds the correct libraries)

    But now the problem is that I need to run it on other computers that do not have the required libQt5Core.so version, the linker says that it cannot find it despite the fact that it's present on the system, it is not the correct version, so I have to ship libQt5core.5.12.2.so (and it's symlinks) but I don't know how to specify, at compilation, where the program has to look for the library, my choice is to put them in the same folder as the executable, for now I run LD_LIBRARY_PATH=/path/to/the/binaryAndlib/folder ./a.out and it finds the libraries but it cannot find libicui18n.so, from the name, my only guess is that it has something to do with the ndk i'm using for the android version of the program.
    How should I fix this missing library ?
    How can I avoid having to run the app with LD_LIBRARY_PATH

    My development system is Ubuntu 18.10, the laptop I failed to run the program on is also running Ubuntu 18.10.
    Thanks in advance !


  • Moderators

    This is normal. You should deploy your binaries to use them outside of Qt Creator.

    To deploy on Linux, you can use linuxdeployqt - it's not an official part of Qt, but it's a well-established and tested solution.

    Or you can read through the docs.

    Note: runtime library detection is not done by a linker.


Log in to reply