[Interest] To rpath or not when building Qt

Michael Jackson imikejackson at gmail.com
Wed Mar 11 21:52:44 CET 2015


On Mar 11, 2015, at 9:54 AM, Koehne Kai <Kai.Koehne at theqtcompany.com> wrote:

>> -----Original Message-----
>> From: interest-bounces+kai.koehne=theqtcompany.com at qt-project.org
>> [...]
>>> The usual approach on unix based systems is to ship a script that runs
>>> the executable with the proper library path set. This way you can
>>> support multiple install locations which rpath can't do.
> 
> Well, you can, as long as the relative path is stable.
> 
>> Are the binaries that Qt ships for LINUX built this way?
> 
> No, the Qt SDK executables use relative rpaths (as you can easily see running chrpath on one of them).
> 
> E.g. qmlscene will find libQt5Quick.so.5 always in $ORIGIN/../lib.
> 
>>  I used the "offline"
>> installer for Qt 5.4.1 and I can not seem to make a distribution of my
>> application. (Asked on another thread). Some blogs seem to hint at adjusting
>> the path during the packaging process.
> 
> While it's possible to solve the problem with a shell script setting LD_LIBRARY_PATH, this is IMO ugly. I'd also recommend just adapting the rpath using chrpath then.
> 
> Regards
> 
> Kai
So if i have my executable in [install]/bin and libQt5Core.so.5 in [install]/lib then I should be able to just generate a package by copying the Qt libraries from the Qt 5.4.1 installation location. I am used to stuff like this on OS X where I have to run "install_name_tool" to change the "rpath" on OS X libraries. Sound like something similar for Linux.

Mike Jackson


More information about the Interest mailing list