diff --git a/cmake/ClientMatrices.cmake b/cmake/ClientMatrices.cmake index b257be448..145f32e5e 100644 --- a/cmake/ClientMatrices.cmake +++ b/cmake/ClientMatrices.cmake @@ -90,12 +90,12 @@ get_filename_component(CMAKE_MATRICES_DIR "${CMAKE_MATRICES_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}") file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}) - +# Set relative RUNPATH to the executable if(BUILD_ADDRESS_SANITIZER) - execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CONVERT_SOURCE} -O3 -fsanitize=address -shared-libasan -o ${PROJECT_BINARY_DIR}/mtx2csr.exe + execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CONVERT_SOURCE} -O3 -fsanitize=address -shared-libasan -L${ROCM_PATH}/${CMAKE_INSTALL_LIBDIR} -Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ENV{ROCM_ASAN_EXE_RPATH} -o ${PROJECT_BINARY_DIR}/mtx2csr.exe RESULT_VARIABLE STATUS) else() - execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CONVERT_SOURCE} -O3 -o ${PROJECT_BINARY_DIR}/mtx2csr.exe + execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CONVERT_SOURCE} -O3 -L${ROCM_PATH}/${CMAKE_INSTALL_LIBDIR} -Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ENV{ROCM_EXE_RPATH} -o ${PROJECT_BINARY_DIR}/mtx2csr.exe RESULT_VARIABLE STATUS) endif() @@ -174,6 +174,9 @@ foreach(i RANGE 0 ${len1}) else() file(RENAME ${ROCSPARSE_MTX_DIR}/${mat}/${mat}.mtx ${CMAKE_MATRICES_DIR}/${mat}.mtx) endif() + # mtx2csr.exe is having relative RUNPATH with respect to package install directory + # Set LD_LIBRARY_PATH for running the executable from build directory + set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${ROCM_PATH}/${CMAKE_INSTALL_LIBDIR}") execute_process(COMMAND ${PROJECT_BINARY_DIR}/mtx2csr.exe ${mat}.mtx ${mat}.csr RESULT_VARIABLE STATUS WORKING_DIRECTORY ${CMAKE_MATRICES_DIR}) diff --git a/install.sh b/install.sh index 6c28b70e3..da482907b 100755 --- a/install.sh +++ b/install.sh @@ -371,7 +371,7 @@ done # If matrices_dir_install has been set up then install matrices dir and exit. # if ! [[ "${matrices_dir_install}" == "" ]];then - cmake -DCMAKE_CXX_COMPILER="${rocm_path}/bin/hipcc" -DCMAKE_C_COMPILER="${rocm_path}/bin/hipcc" -DPROJECT_BINARY_DIR=${matrices_dir_install} -DCMAKE_MATRICES_DIR=${matrices_dir_install} -P ./cmake/ClientMatrices.cmake + cmake -DCMAKE_CXX_COMPILER="${rocm_path}/bin/hipcc" -DCMAKE_C_COMPILER="${rocm_path}/bin/hipcc" -DPROJECT_BINARY_DIR=${matrices_dir_install} -DCMAKE_MATRICES_DIR=${matrices_dir_install} -DROCM_PATH=${rocm_path} -DCMAKE_INSTALL_LIBDIR=lib -P ./cmake/ClientMatrices.cmake exit 0 fi @@ -388,7 +388,7 @@ if ! [[ "${matrices_dir}" == "" ]];then # Let's 'reinstall' to the specified location to check if all good # Will be fast if everything already exists as expected. # This is to prevent any empty directory. - cmake -DCMAKE_CXX_COMPILER="${rocm_path}/bin/hipcc" -DCMAKE_C_COMPILER="${rocm_path}/bin/hipcc" -DPROJECT_BINARY_DIR=${matrices_dir} -DCMAKE_MATRICES_DIR=${matrices_dir} -P ./cmake/ClientMatrices.cmake + cmake -DCMAKE_CXX_COMPILER="${rocm_path}/bin/hipcc" -DCMAKE_C_COMPILER="${rocm_path}/bin/hipcc" -DPROJECT_BINARY_DIR=${matrices_dir} -DCMAKE_MATRICES_DIR=${matrices_dir} -DROCM_PATH=${rocm_path} -DCMAKE_INSTALL_LIBDIR=lib -P ./cmake/ClientMatrices.cmake fi build_dir=./build