Qt 5 Linux Dynamic Linking

How to dynamically link a Qt 5 application in Linux

 

Put the following in your Linux application’s project file:

unix:!mac {
LIBS += -Wl,-rpath=\\\$$ORIGIN/libs
}

Go to your application’s folder and create a folder called libs, and copy the following files from your Qt5 installation librairies to it from your lib folder of your QT 5 installation. Some of the files may be links, so copy the files referred to by the links also, or copy the linked to files and rename them to these:

Example lib location:

/home/user/Qt5.0.2/5.0.2/gcc/lib

Files to copy:

libicuuc.so.49
libQt5Core.so.5
libQt5DBus.so.5
libQt5Gui.so.5
libQt5Widgets.so.5
libicudata.so.49
libicui18n.so.49

Then copy the platforms folder from your Qt 5 installation’s plugins folder to your application’s folder.

Your application should now dynamically link and be ready for deployment.

 

Advertisements