[Qt-interest] Adding libraries to .pro file

paulf at free.fr paulf at free.fr
Fri Oct 22 12:57:49 CEST 2010



> When I build projects in my $HOME, it works for me

I should have been more precise. Absolute paths in RPATH will work fine, but not if you change the base directory.

Lets say you have /home/user/work/app/bin/myapp and /home/user/work/app/lib/libmylib.so. If I link myapp with /home/paulf/work/app/lib in the RPATH, it will work fine. But if I then go and install myapp in /usr/local/bin and libmylib.so in /usr/local/lib, it won't work any more.

Workarounds for this:
Put /home/user/work/app/lib:/usr/local/lib in the RPATH
(only works if you're certain to install to /usr/local/lib

Put $ORIGIN/../lib in the RPATH
(will work as long as libmylib.so can be found at ../lib relative to myapp, subject to restrictions)

Use a tool to modify the RPATH when you install the app (has restrictions)

Use LD_LIBRARY_PATH or ldconfig

A+
Paul



More information about the Qt-interest-old mailing list