Replacing RPATH when deploying shared Qt libraries
Setting up
-
I have a local Qt installation located in my home directory:
/home/user/Qt/...
(from now on, devdir). -
The Qt application I am trying to install installs the corresponding shared Qt libraries on
/usr/lib/myapplication
(from now on, installdir). -
My packaging process is currently set up like this:
qmake
>dh_make -s --createorig
>debuild
Problem
I am trying to set RPATH
in myapplication.pro just to link to libraries in installdir, but currently it links to both installdir and devdir.
I think it has to do with qmake
automatically generating dependencies for the installation libraries. To stop it, I followed the build process with with qmake -nodepend
, but that didn't stop communicating with devdir.
How do I force qmake
installdir to link only to libraries?
code
In myapplication.pro:
QMAKE_LFLAGS = -Wl,-rpath,/usr/lib/myapplication
The resulting link flags in the Makefile are:
LFLAGS = -Wl,-rpath,/usr/lib/myapplication -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-rpath,/home/user/Qt/5.3/gcc_64 -Wl,-rpath,/home/user/Qt/5.3/gcc_64/lib
source to share
The path to /home/user/Qt/5.3/gcc_64
can be deleted by overwriting QMAKE_RPATHDIR
. To suppress both paths, the variable QMAKE_LFLAGS_RPATH
must be empty, as in Setting RPATH Order in QMake
# rpath variables for unix
unix: {
# suppress the default RPATH
QMAKE_LFLAGS_RPATH =
# add custom path
QMAKE_LFLAGS = -Wl,-rpath,/usr/lib/myapplication
}
source to share