[Interest] Loading libraries from root folder

Konrad Rosenbaum konrad at silmor.de
Thu Sep 19 10:37:05 CEST 2013


On Monday 09 September 2013 13:05:07 Till Oliver Knoll wrote:
> Using the rpath linker option with a /relative/ path like "./lib" (relative
> to the binary) worked for me. So I don't quite follow the disadvantage

Important note: relative rpathes are not relative to the executable, they are 
relative to the current working directory!

The correct option is: -Wl,-rpath,\$ORIGIN

or with a few more quotes for qmake:
linux {
 QMAKE_LFLAGS += -Wl,-rpath,\'\$$ORIGIN\'
}

rpath $ORIGIN forces the executable to look for any library in the same 
directory as the executable first. If you want to be a bit nicer to the 
runtime environment add -Wl,--enable-newdtags - then the $ORIGIN argument will 
end up in runpath, which is checked later (between $LD_LIBRARY_PATH and system 
pathes), but which is not-transient (i.e. libraries linked by libraries are 
not searched in $ORIGIN unless the linking library set the runpath as well).


	Konrad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130919/882e091b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130919/882e091b/attachment.sig>


More information about the Interest mailing list