Add mount-agnostic RTI RUNPATH so binaries load under any mount point
The RTI Connext libraries live outside the tree (pipeline-root external/rti_connext_dds-7.7.0). CMake bakes their absolute path into the RUNPATH, which only resolves on the build host's mount - running the built binaries under another mount (e.g. /workspace) failed with 'libnddsc.so: cannot open shared object file'. Add a $ORIGIN-relative RUNPATH entry (5 levels up from any bin/ or lib/ artifact is the pipeline root) so the RTI libraries resolve regardless of the mount point. No LD_LIBRARY_PATH needed anymore. Verified: ddscore_unit_test runs with no env vars set.
This commit is contained in:
1 parent
473462cbdb
commit
874efd4733
1 file changed
+9
@@ -46,6 +46,15 @@ include(CTest)
|
|||||||
|
|
||||||
# Set RPATH to find libraries in build directory
|
# Set RPATH to find libraries in build directory
|
||||||
SET(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/lib")
|
SET(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/lib")
|
||||||
|
# The RTI Connext libraries live outside the tree (pipeline-root
|
||||||
|
# external/rti_connext_dds-7.7.0). The absolute path CMake bakes into the
|
||||||
|
# RUNPATH only resolves on the mount of the build host, so also add a
|
||||||
|
# $ORIGIN-relative entry (5 levels up from any bin/ or lib/ artifact is
|
||||||
|
# the pipeline root) so the binaries load under any mount point
|
||||||
|
# (e.g. /workspace) without LD_LIBRARY_PATH.
|
||||||
|
SET(CMAKE_BUILD_RPATH
|
||||||
|
"${CMAKE_BUILD_RPATH};"
|
||||||
|
"$ORIGIN/../../../../../external/rti_connext_dds-7.7.0/resource/app/lib/x64Linux4gcc8.5.0")
|
||||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib")
|
SET(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib")
|
||||||
SET(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
|
SET(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user