[SOLVED] Add dependency directory for deployment?
-
Hi,
I have multiple libraries associated with my application and I would like to make a sub directory in the install directory that has all of the libs (including Qt libraries). All of my custom Qt libraries are linked in the .pro file and the application builds / runs fine in the debugger.
So for example:
Program Folder/executable
Program Folder/libs/utility.so
Program Folder/libs/QtCore.so
Program Folder/libs/other library...
Program Folder/custom_libs/custom_lib1.so
Program Folder/custom_libs/custom_lib2.soIs there a way in QMake to tell the application on startup to look for the libraries in the sub folder lib and custom_libs (instead of having to manually add to LD_LIBRARY_PATH using export) or having a massive amount of libraries in the executable directory?
I have tried QApplication::addLibraryPath(), and it did not work.
-
Hi,
IIRC there's the "qt.conf file":http://qt-project.org/doc/qt-4.8/qt-conf.html that you can use.
Hope it helps
-
Very cool. I will give it shot. I have never used it before, but from the docs, it looks like you can only designate one path in the plugins key, which would not allow me to add two sub directories for libs...
Since my project is actually a Qt Console application, shouldn't I be able to use QCoreApplication::addLibraryPath() for the two directories containing my custom '.so' files?
Thank you again for your help.
-
qt.conf allows you to modify the hardcoded path to get the Qt libraries and addLibraryPath is to provide additional folder to find plugins.
So indeed, it might not be what you need.
There might be something you can do with linker flags like rpath.
Anyway, when you have such a folder tree, it's not uncommon to provide a shell script to start the application with LD_LIBRARY_PATH (IIRC Firefox does it, QtCreator also)
-
Hi,
As you stated, the qt.conf only allowed me to point to that directory for the Qt Libs. I did try using a qmake compiler statement in the .pro adding --rpath, which indeed worked, but made things really ugly in my .pro/.pri files.
I have resulted to a bash script right now that sets LD_LIBRARY_PATH. It may not be the best way to deploy, but it definitely cleans up everything in the application directory.
Thank you again SGaist.
-
You're welcome,
It's a good way to deploy your application. Depending on your target distributions you can also provide a package (deb, rpm)