Qt 5 linux deployment - using qt.conf for dynamic linking
-
wrote on 30 Mar 2013, 12:16 last edited by
I have a Qt 5 app that I don't want to opensource (so I don't want to do a static build of Qt 5 from source). I'm trying to dynamic link the required dependencies using the ldd command, and a qt.conf file in the same folder as the executable. Is this possible? I really would rather not do a static build of Qt 5 and opensource my app. I would like to offer my app as a tar.gz (with dependencies). Here's what I have in my qt.conf:
[Paths]
PrefixPath = data
LibrariesPath = libs_32
TranslationsPath = translationsAnd my folder looks like this:
Executable
qt.conf
data/libs_32/
data/translations/
platforms/libs_32 contains the dependencies listed by the ldd command. Also, do I need translations?
The above configuration doesn't work. It only works with Qt 5 installed, which means it's looking for some hard-coded paths I'm missing or configuring incorrectly. Am I missing something or doing something wrong? Any input would greatly be appreciated. Thanks in advance.
-
wrote on 30 Mar 2013, 20:09 last edited by
With my experience qt.conf works only on Linux. On Windows is necessary to store the qt libraries in the executable folder-. In Mac you have to run macedeployqt.
-
wrote on 30 Mar 2013, 20:34 last edited by
I am in Linux. But despite pointing the executable to the dependencies, it's still looking for some hard-coded paths. It runs with Qt 5 installed. When I temporarily move the Qt 5 installation to Trash, the application will not run.
-
wrote on 30 Mar 2013, 20:52 last edited by
Sorry. With linux I use qt.conf only for plugins.
Please insert in your .pro file the rows below:unix:!mac {
LIBS += -Wl,-rpath=\$$ORIGIN/libs
}and then please store your required libraries in libs subfolder.
-
wrote on 30 Mar 2013, 23:36 last edited by
I tried it. It didn't work. In my app folder I have:
myapp
libs/
platforms/Any ideas?
-
wrote on 31 Mar 2013, 00:38 last edited by
The Qt libraries needed (libicuxxx, libQt5Corexxx, libQt5Guixxx, libQt5WidgetsXXX) are listed in the Qt 5 library as links to other versions of those files. Maybe resolving the dependencies is having a problem with that.
-
wrote on 31 Mar 2013, 09:49 last edited by
Can you try to download and compile that?
http://kde-apps.org/content/show.php?content=149622
I'm sure that works correctly with Qt 4.8.4 -
wrote on 31 Mar 2013, 09:56 last edited by
I did a build in Qt 4.8.2 (installed from the software manager in Linux Mint 14 32 bit) and everything works perfectly. I tried it with a shell wrapper also, and also a qt.conf and everything works. There's definitely a problem with dynamic linking with Qt 5.
-
wrote on 31 Mar 2013, 10:51 last edited by
This means that for now I can't use Qt 5. When you will find the solution please post here.
-
wrote on 31 Mar 2013, 12:06 last edited by
If I find a solution I will post it. Maybe when Qt 5.1.0 comes out it will be solved (scheduled for some time in April if no delays). Note that I didn't have any problems with dynamic linking in Qt 5 with a Windows build. Just Linux.
-
wrote on 1 Apr 2013, 12:08 last edited by
I was missing libQt5DBus in my dependencies. It was not listed by the ldd command. I found that out on another forum. Dynamic linking in Qt 5 works for me now, both using your addition to the .pro file, and a wrapper shell script. But I can't get a qt.conf to work. I saw somewhere where it doesn't for Windows builds. Maybe not Linux either. It works for Qt 4.8.2. I'll check the bug reports to see if it is already reported. Qt 5 dynamic linking works.
-
wrote on 1 Apr 2013, 12:18 last edited by
Yes, you're right. qt.conf works only with plugins for me.
-
wrote on 2 Apr 2013, 11:19 last edited by
I filed a bug report. Here's the answer I got:
Quote: "
qt.conf can not make the linker look for libraries in a different location, it's simply technically not possible. The "Libraries" entry (and all other entries) are only fixing up the paths that the QLibraryInfo API returns.
From the qt.conf documentation:
The qt.conf file overrides the hard-coded paths that are compiled into the Qt library. These paths are accessible using the QLibraryInfo class.
If you want to make your application/libraries look for Qt at a different location, your only choice are the options that the linker offers you, i.e. on Linux basically LD_LIBRARY_PATH or rpath (e.g. with $ORIGIN to make it independent from absolute paths)." UnQuote. FYI.
-
wrote on 2 Apr 2013, 11:57 last edited by
Ok. Thanks for the investigation and the explanation.
1/14