about rpath "automagic" (CMAKE_INSTALL_RPATH)

René J. V. Bertin rjvbertin at gmail.com
Mon Feb 8 10:14:09 UTC 2016


Hi,


Alex Merry wrote:

>> 1) I see it does `set(CMAKE_INSTALL_RPATH "${_abs_LIB_INSTALL_DIR}")` .
>> Shouldn't that be `set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH;
>> ${_abs_LIB_INSTALL_DIR}"), IOW, shouldn't the additional path be
>> appended (or
>> prepended...) to the existing RPATH?!
> 
> Quite possibly.

Sounds like I'll be putting up a RR then.

> 
>> 2) I did find that I have to set
>> `-DCMAKE_INSTALL_RPATH="/opt/local/lib/x86_64-
>> linux-gnu\;/opt/local/lib"` on Linux, presumably because Kubuntu's
>> multi-arch
>> configuration is detected. Why does the build system not pick that fact
>> up,
>> while it clearly does pick up the non-standard Qt library locations?
>> Maybe it
>> considers /opt/local/lib/x86_64-linux-gnu a system location because
>> cmake itself
>> is installed under /opt/local ?
> 
> The mechanism by which packages are found is completely independent, and
> (more or less) involves CMake searching the filesystem recursively for
> *Config.cmake files, which then tell it where to find, say, Qt. Our

Hmm, yes, it looks like I was mixing up things. My Qt .cmake files are in 
cmake's standard search path (${prefix}/lib/cmake) but I do have to set the 
appropriate variable to ensure that those scripts use the correct qmake.
>From what I understand everything Qt5-related is actually determined from 
qmake's location and/our output.

> RPATH handling logic isn't clever enough to account for found packages,
> though.

Actually, *your* (as in KF5's) RPATH handling is clever enough to account for 
the required Qt5 rpath.

> 
> It's possible that CMake could figure out the necessary RPATH settings
> itself. It's worth re-visiting this, I think.

I think it'd be hard to determine what's necessary and/or sufficient in this 
context - it'd have to determine file name of each library and then attempt to 
dlopen it using the name only (if that succeeds it is not necessary to add the 
library's path to the RPATH)?
OTOH, it could add all paths to shared libraries that are not stock/default 
paths to RPATH.

>> the commandline. If that means KDECMakeSettings.cmake doesn't do its
>> job in my
>> set-up, then the mystery stands how KF5 builds manage to add
>> /opt/local/libexec/qt5/lib to the rpath ...
> 
> No. The fact that it is in the CMakeCache.txt at all is just an artifact
> of you passing it on the command line.

So the mystery stands ...

R.



More information about the Kde-buildsystem mailing list