From 5048e9e84082a77a683f7087f47b5e92e89e2059 Mon Sep 17 00:00:00 2001 From: fpetrini15 Date: Fri, 25 Oct 2024 11:16:19 -0700 Subject: [PATCH] Add RPATH --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ef2c388..d27f10a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,9 +96,11 @@ FetchContent_Declare( # RHEL base container has multiple version of Python installed. By default # it seems like pybind will pickup v3.6, so we specifically assign it to # search for 3.12 here. +set(RHEL_BUILD OFF) if(LINUX) file(STRINGS "/etc/os-release" DISTRO_ID_LIKE REGEX "ID_LIKE") if(${DISTRO_ID_LIKE} MATCHES "rhel|centos") + set(RHEL_BUILD ON) set(PYBIND11_PYTHON_VERSION 3.12) endif(${DISTRO_ID_LIKE} MATCHES "rhel|centos") endif(LINUX) @@ -278,6 +280,23 @@ target_compile_options( ) target_compile_definitions(triton-python-backend-stub PRIVATE TRITON_PB_STUB) +# RHEL assets are not released in a container environment nor do the current +# Python lib versions in the manylinux base container match those currently +# available for RHEL8 package managers. Therefore, we package the correct +# python libs in the backend folder and adjust the stub executable to look +# in its own folder at runtime. +if(RHEL_BUILD) + set_target_properties( + triton-python-backend-stub + PROPERTIES + SKIP_BUILD_RPATH TRUE + BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH FALSE + INSTALL_RPATH "$\{ORIGIN\}" + ) +endif(RHEL_BUILD) + + # For WIN32 do not link Threads and DL_LIBS if(WIN32) target_link_libraries(