[Interest] To rpath or not when building Qt

Nikos Chantziaras realnc at gmail.com
Wed Mar 11 22:55:02 CET 2015


On 11/03/15 23:31, Nikos Chantziaras wrote:
> On 11/03/15 22:52, Michael Jackson wrote:
>> 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.
>
> The utility is called "chrpath". Simply install it through your package
> manager.
>
> It's this here:
>
> http://directory.fsf.org/wiki/Chrpath

Correction: for chrpath to work, the binaries (executables or libraries) 
must already have a RPATH or RUNPATH entry. So using chrpath doesn't 
make sense until you want to change those paths. But if you use $ORIGIN, 
you don't need to adapt the paths at all. If you wanted to load 
libraries from "[install]/lib" while your executable is in 
"[install]/bin", you'd link with:

   -Wl,-rpath=\$ORIGIN/../lib,--enable-new-dtags

This will result in libraries getting loaded from "../lib" relative to 
your executable, regardless on where that executable is installed on the 
system.




More information about the Interest mailing list