Runtime Path not set correctly using CMake
When building a project using CMake it seems that the runtime path is incorrectly set. For example, when building Cfg
in an IGWN Conda environment using CMT and I print the libraries dependencies I get the following:
(igwn-py39) poulton@ctrl1[~/packages/Cfg/v9r0/cmt]: ldd /users/poulton/packages/Cfg/v9r0/Linux-x86_64-CL7/lib/libcfg.so
linux-vdso.so.1 => (0x00007ffc74139000)
libcm.so.9 => /cvmfs/oasis.opensciencegrid.org/ligo/sw/conda/envs/igwn-py39-20210916/lib/libcm.so.9 (0x00007fc8c0d4f000)
libc.so.6 => /lib64/libc.so.6 (0x00007fc8c07c8000)
where Cm points to the IGWN Conda and not the one I specified using CMT. I see the same result if I use /usr/bin/ldd
. This is strange since in the PackageBuild configure flags I see:
-DCMAKE_INSTALL_RPATH=/users/poulton/packages/Cfg/v9r0/Linux-x86_64-CL7/lib:/users/poulton/packages/Cm/v9r0/Linux-x86_64-CL7/lib
and CMake itself says:
-- Set runtime path of "/users/poulton/packages/Cfg/v9r0/Linux-x86_64-CL7/lib/libcfg.so.9.0.0" to "/users/poulton/packages/Cfg/v9r0/Linux-x86_64-CL7/lib:/users/poulton/packages/Cm/v9r0/Linux-x86_64-CL7/lib"
When I instead do a meson build, I find I get the correct path to the Cm
library:
(igwn-py39) poulton@ctrl1[~/packages/Cfg/v9r0/cmt]: ldd /users/poulton/packages/Cfg/v9r0/Linux-x86_64-CL7/lib/libcfg.so
linux-vdso.so.1 => (0x00007ffef9d57000)
libcm.so.9 => /users/poulton/packages/Cm/v9r0/Linux-x86_64-CL7/lib/libcm.so.9 (0x00007fee77acc000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fee776fb000)
libc.so.6 => /lib64/libc.so.6 (0x00007fee7732d000)
/lib64/ld-linux-x86-64.so.2 (0x00007fee77917000)
It seems that this is most likely just an issue with CMake itself rather than CMT/ PackageBuild.