[Interest] qmake and rpath

Nikos Chantziaras realnc at gmail.com
Fri Apr 26 17:14:12 CEST 2013


On 26/04/13 16:23, Wilhelm wrote:
> Hi all,
>
> I have a problem with qmake setting rpath:
>[...]
>
> QMAKE_RPATHDIR += ../lib
>
> by this gives me
>
> -Wl,-rpath,/home/lmeier/Software/qtwm/branches/macros/apps/apps5/lib
>
> in the Makefile, and that's not correct.
>
> How do I set the rpath to point to the build dir and not to the source
> dir of the lib?

You have to use the $ORIGIN feature of the runtime linker. 
Unfortunately, due to some brilliant foresight of the loader devs, they 
used '$' as prefix, which makes it a royal pain in the ass to pass 
around.  It's impossible to use it in QMAKE_RPATHDIR.  You must instead use:

   QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN/../lib\''

so that it survives both the project file as well as the Makefile.

$ORIGIN will make sure that "../lib" is always relative to the directory 
containing the executable.




More information about the Interest mailing list