From 8cca56d5030eb97f23638e07b0ed242fb3942706 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Wed, 7 Aug 2024 16:33:53 +0200 Subject: [PATCH] Set RPATH for the loader --- docs/building_and_running_tests.rst | 3 --- docs/using_onemkl_with_cmake.rst | 12 ------------ src/CMakeLists.txt | 2 ++ 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/docs/building_and_running_tests.rst b/docs/building_and_running_tests.rst index 43d3431af..114e4492d 100644 --- a/docs/building_and_running_tests.rst +++ b/docs/building_and_running_tests.rst @@ -46,6 +46,3 @@ To run the tests, either run test binaries individually, or use ``ctest`` CMake For more ``ctest`` options, refer to `ctest manual page `_. -When running tests you may encounter the issue ``BACKEND NOT FOUND EXCEPTION``, -you may need to add your ``/lib`` to your -``LD_LIBRARY_PATH`` on Linux. diff --git a/docs/using_onemkl_with_cmake.rst b/docs/using_onemkl_with_cmake.rst index 5fb497362..03f828bf4 100644 --- a/docs/using_onemkl_with_cmake.rst +++ b/docs/using_onemkl_with_cmake.rst @@ -50,12 +50,6 @@ during the build. To check for the existence of backends, CMake's ``if(TARGET message(FATAL_ERROR "oneMKL Interfaces was not built with CuFFT backend") endif() - -If oneMKL Interfaces has been installed to a non-standard location, the -operating system may not find the backend libraries when they're lazily loaded -at runtime. To make sure they're found you may need to set -``LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH`` on Linux. - .. _using_with_fetchcontent: Using CMake's FetchContent @@ -93,10 +87,4 @@ against particular backends (as required for static dispatch of oneAPI calls to a particular backend), use the target ``onemkl__``. For example, ``onemkl_dft_cufft``. -When using the run-time dispatch mechanism, it is likely that the operating -system will not find the backend libraries when they're loaded at runtime. To -make sure they're found you may need to set -``LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH`` on Linux. - - .. _FetchContent: https://cmake.org/cmake/help/latest/module/FetchContent.html diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b632c1bd..0ab646aca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,6 +81,8 @@ if(BUILD_SHARED_LIBS) set (ONEMKL_LIBS ${TARGET_DOMAINS}) list(TRANSFORM ONEMKL_LIBS PREPEND onemkl_) target_link_libraries(onemkl PUBLIC ${ONEMKL_LIBS}) + set_target_properties(onemkl PROPERTIES + INSTALL_RPATH "\$ORIGIN") # Add the library to install package foreach(domain_lib ${ONEMKL_LIBS})