[Interest] To rpath or not when building Qt

Thiago Macieira thiago.macieira at intel.com
Thu Mar 12 00:59:25 CET 2015


On Wednesday 11 March 2015 23:50:52 Nikos Chantziaras wrote:
> On 10/03/15 21:07, Scott Aron Bloom wrote:
> > When building Qt for distribution via LGPL of a closed source product
> > using shared libraries.
> > 
> > What is the best method to make sure the plugins pickup the Qt libraries
> > you are shipping?
> 
> As Thiago mentioned, you can use RPATH. However, RPATH is overridable.

s/overridable/non-overridable/

> What you *really* want to set is RUNPATH. If you want to load the
> plugins from a directory that exists inside the directory of your
> executable, then use "$ORIGIN" as the prefix.

I personally prefer RUNPATH, so that I can override when I want to.

> For reference, if you want to use RPATH instead of RUNPATH, use:
> 
>    -Wl,-rpath=\$ORIGIN/lib,--disable-new-dtags
> 
> Note: it is somewhat of a nightmare to escape the "$" in "\$ORIGIN" in a
> way that can make it undamaged to the final link command. The shell must
> receive "\$ORIGIN", and until it makes it there, it can pass through
> several processing stages. You might need an unholy amount of escape
> sequences ("\\\\$ORIGIN" or similar.) Trial end error :-/

See Creator's source code for the way to do it with qmake.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list