From 7852bf573b347baf60195f4bf09ea4b4104b6507 Mon Sep 17 00:00:00 2001 From: Arm Patinyasakdikul Date: Thu, 14 May 2026 16:38:49 -0500 Subject: [PATCH] pkg: drop hsa-rocr dep, warn at install time instead The relocatable DEB/RPM hard-depended on hsa-rocr, but ROCm 7.13 no longer ships a package by that name -- install fails on TheRock 7.13 with "amdrocm7-transferbench depends on hsa-rocr; however: Package hsa-rocr is not configured yet" (ROCM-24669). The dep also never made sense for the relocatable artifact: it is built from the TheRock SDK and meant to install on systems where ROCm came from a tarball and is not tracked by apt/dpkg at all. Any apt dep on a ROCm component breaks that audience. Drop hsa-rocr from CPACK_DEBIAN_PACKAGE_DEPENDS, CPACK_RPM_PACKAGE_REQUIRES, and the legacy rocm_package_add_dependencies call. Wire a shared scriptlet (packaging/postinst-check-hsa.sh) as the DEB postinst and the RPM %post that probes ldconfig + the standard /opt/rocm{,-*,/extras-*, /core-*}/lib prefixes for libhsa-runtime64.so.1 and prints a stderr warning when none of them have it. Always exits 0 so install never fails on its account -- the warning surfaces the missing runtime at install time instead of as a dynamic-linker error on first run. numactl / libnuma1 stay in the dep list since those are real OS packages that exist independent of any ROCm install. --- CMakeLists.txt | 17 +++++++++-- packaging/postinst-check-hsa.sh | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 3 deletions(-) create mode 100755 packaging/postinst-check-hsa.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index f8d1c74..0acb9c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,7 +360,7 @@ if(BUILD_RELOCATABLE_PACKAGE) # DEB set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") - set(CPACK_DEBIAN_PACKAGE_DEPENDS "numactl, libnuma1, hsa-rocr") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "numactl, libnuma1") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT}") if(NOT "${_tb_pkg_release}" STREQUAL "") set(CPACK_DEBIAN_PACKAGE_RELEASE "${_tb_pkg_release}") @@ -373,7 +373,7 @@ if(BUILD_RELOCATABLE_PACKAGE) # RPM set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") set(CPACK_RPM_PACKAGE_LICENSE "MIT") - set(CPACK_RPM_PACKAGE_REQUIRES "numactl, hsa-rocr") + set(CPACK_RPM_PACKAGE_REQUIRES "numactl") set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") if(NOT "${_tb_pkg_release}" STREQUAL "") set(CPACK_RPM_PACKAGE_RELEASE "${_tb_pkg_release}") @@ -394,6 +394,17 @@ if(BUILD_RELOCATABLE_PACKAGE) "${_rpm_exclude_prefix}" "${_rpm_exclude_prefix}/bin") + # Advisory install-time check for libhsa-runtime64.so.1. The package declares + # no hard ROCm dep so it can install on TheRock-tarball systems where no ROCm + # component is tracked by apt/dpkg; the postinst warns (never fails) when the + # HSA runtime is not discoverable, so a missing runtime surfaces at install + # time instead of as a dynamic-linker error on first invocation. + set(_tb_postinst_src "${CMAKE_CURRENT_SOURCE_DIR}/packaging/postinst-check-hsa.sh") + set(_tb_postinst_deb "${CMAKE_BINARY_DIR}/packaging/postinst") + configure_file("${_tb_postinst_src}" "${_tb_postinst_deb}" COPYONLY) + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${_tb_postinst_deb}") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${_tb_postinst_src}") + # TGZ — embed release tag so successive runs do not collide on the same key. # CMake 3.13+ honors CPACK_ARCHIVE_FILE_NAME for archive generators, but # CMake 3.22 (Ubuntu 22.04) falls back to CPACK_PACKAGE_FILE_NAME for TGZ. @@ -414,7 +425,7 @@ else() rocm_setup_version(VERSION ${VERSION_STRING}) # Package specific CPACK vars - rocm_package_add_dependencies(DEPENDS "numactl" "hsa-rocr") + rocm_package_add_dependencies(DEPENDS "numactl") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md") set(CPACK_RPM_PACKAGE_LICENSE "MIT") diff --git a/packaging/postinst-check-hsa.sh b/packaging/postinst-check-hsa.sh new file mode 100755 index 0000000..9b0b250 --- /dev/null +++ b/packaging/postinst-check-hsa.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Advisory check used as both the DEB postinst and the RPM %post scriptlet. +# TransferBench links against libhsa-runtime64.so.1; without it the binary +# fails at first run with a dynamic-linker error. The relocatable package +# declares no hard dep on hsa-rocr (or any ROCm component) because it is +# expected to install on TheRock-tarball systems where no ROCm package is +# tracked by apt/dpkg. Warn here so the user diagnoses a missing runtime +# at install time, not at TransferBench launch. +# +# Always exits 0 — this is advisory, never fatal. + +set -e + +found=0 + +if command -v ldconfig >/dev/null 2>&1; then + if ldconfig -p 2>/dev/null | grep -q 'libhsa-runtime64\.so\.1'; then + found=1 + fi +fi + +if [ "$found" -eq 0 ]; then + for d in /opt/rocm/lib /opt/rocm/lib64 /opt/rocm-*/lib /opt/rocm/extras-*/lib /opt/rocm/core-*/lib; do + if [ -e "$d/libhsa-runtime64.so.1" ]; then + found=1 + break + fi + done +fi + +if [ "$found" -eq 0 ]; then + cat >&2 <<'EOF' +==================================================================== +TransferBench: WARNING + +libhsa-runtime64.so.1 was not found on the dynamic loader path or +under any of /opt/rocm/lib, /opt/rocm-*/lib, or /opt/rocm/extras-*/lib. + +TransferBench requires the ROCm HSA runtime at run time. Install a +ROCm 7.x stack (system packages or TheRock SDK) before invoking +TransferBench, or set LD_LIBRARY_PATH to a directory containing +libhsa-runtime64.so.1. + +Without it, TransferBench will fail at startup with: + error while loading shared libraries: libhsa-runtime64.so.1 +==================================================================== +EOF +fi + +exit 0