Skip to content

Commit 6b39803

Browse files
estewart08jithunnair-amd
authored andcommitted
Use -rpath-link to fix libtinfo conflict.
The ROCm libtinfo6 is conflicting with the libtinfo6 installed in the conda envirnonment in /opt/conda/lib. This is first in the build rpath and causes issues on Ubuntu 20.04 when resolving libamd_comgr.so dependencies. Use -rpath-link to resolve dependencies where the system libtinfo is found instead. This is currently active on versions >= 20.04.
1 parent 97d23f6 commit 6b39803

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cmake/Dependencies.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,20 @@ endif()
12351235

12361236
# ---[ HIP
12371237
if(USE_ROCM)
1238+
# This prevents linking in the libtinfo from /opt/conda/lib which conflicts with ROCm libtinfo.
1239+
# Currently only active for Ubuntu 20.04 and greater versions.
1240+
if(UNIX)
1241+
execute_process(COMMAND bash -c "cat /etc/os-release | grep -e '^NAME=' | awk -F\\\" '{print $2}'" OUTPUT_VARIABLE OS_DISTRO OUTPUT_STRIP_TRAILING_WHITESPACE)
1242+
execute_process(COMMAND bash -c "cat /etc/os-release | grep VERSION_ID | awk -F\\\" '{print $2}'" OUTPUT_VARIABLE OS_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
1243+
if(OS_DISTRO STREQUAL "Ubuntu" AND OS_VERSION VERSION_GREATER_EQUAL "20.04")
1244+
find_library(LIBTINFO_LOC tinfo NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH)
1245+
if(LIBTINFO_LOC)
1246+
get_filename_component(LIBTINFO_LOC_PARENT ${LIBTINFO_LOC} DIRECTORY)
1247+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${LIBTINFO_LOC_PARENT}")
1248+
endif()
1249+
endif()
1250+
endif()
1251+
12381252
include(${CMAKE_CURRENT_LIST_DIR}/public/LoadHIP.cmake)
12391253
if(PYTORCH_FOUND_HIP)
12401254
message(INFO "Compiling with HIP for AMD.")

0 commit comments

Comments
 (0)