Important: Please read the Qt Code of Conduct -

How to move Qt5 installation directory [LINUX]

  • Our Linux deployment essentially requires moving the Qt5 installation directory.

    There appear to be two issues: binary files, and library files.

    Cobbling together information across the Internet, I've added a "qt.conf" file to the install/bin directory, with the new directory location. This fixes the binary files pointing to the wrong installation. "qmake -query" now points to the new location. Good.

    Running "ldd" on any of the libraries in /lib results in "not found" errors for libraries that reside together in the same directory. Similar problems for libraries in /plugins/platforms.

    Is there a way to build Qt so it uses relative paths instead of hard coded paths for it's own libraries??

  • On Linux you can use LD_LIBRARY_PATH environment variable to point to the libraries location.
    export LD_LIBRARY_PATH=/Path/toQt/lib:$LD_LIBRARY_PATH
    ldd /Path/toQt/lib/

  • Hi, you can export LD_LIBRARY_PATH as andreyc says. Or, if you want to use relative paths, you can use the chrpath utility to change the rpaths of your .so file and main executable file so that they can find each other when they're in the same directory. (I've written about it "here": scroll down to Linux GCC section)

Log in to reply