[Interest] To rpath or not when building Qt

Thiago Macieira thiago.macieira at intel.com
Tue Apr 14 18:48:02 CEST 2015


On Tuesday 14 April 2015 12:37:32 Mike Jackson wrote:
> > > 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.
> > 
> Is there a way to do this _during_ the packaging of the application? 

No, the RPATH fields need to be created during linking.

What you can do is write a very, very long path and then use the chrpath tool 
to modify it during packaging.

> If I
> add those link commands then will I not need to copy all the Qt Libraries
> into my build folder?

Do you mean whether you have to ship the Qt libraries with your application? 
That is orthogonal to the question here. If you want to rely on your users 
installing Qt from their distro, you can.

> Anyone have any experience doing any of this from
> CMake? It looks like CMake may have something already figured out,

The tool shouldn't matter here.

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




More information about the Interest mailing list