Skip to content

Commit a4cd6e5

Browse files
authored
pkg: drop hsa-rocr dep, warn at install time instead (#300)
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.
1 parent 0e824cc commit a4cd6e5

2 files changed

Lines changed: 64 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ if(BUILD_RELOCATABLE_PACKAGE)
360360
# DEB
361361
set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
362362
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
363-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "numactl, libnuma1, hsa-rocr")
363+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "numactl, libnuma1")
364364
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT}")
365365
if(NOT "${_tb_pkg_release}" STREQUAL "")
366366
set(CPACK_DEBIAN_PACKAGE_RELEASE "${_tb_pkg_release}")
@@ -373,7 +373,7 @@ if(BUILD_RELOCATABLE_PACKAGE)
373373
# RPM
374374
set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
375375
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
376-
set(CPACK_RPM_PACKAGE_REQUIRES "numactl, hsa-rocr")
376+
set(CPACK_RPM_PACKAGE_REQUIRES "numactl")
377377
set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}")
378378
if(NOT "${_tb_pkg_release}" STREQUAL "")
379379
set(CPACK_RPM_PACKAGE_RELEASE "${_tb_pkg_release}")
@@ -394,6 +394,17 @@ if(BUILD_RELOCATABLE_PACKAGE)
394394
"${_rpm_exclude_prefix}"
395395
"${_rpm_exclude_prefix}/bin")
396396

397+
# Advisory install-time check for libhsa-runtime64.so.1. The package declares
398+
# no hard ROCm dep so it can install on TheRock-tarball systems where no ROCm
399+
# component is tracked by apt/dpkg; the postinst warns (never fails) when the
400+
# HSA runtime is not discoverable, so a missing runtime surfaces at install
401+
# time instead of as a dynamic-linker error on first invocation.
402+
set(_tb_postinst_src "${CMAKE_CURRENT_SOURCE_DIR}/packaging/postinst-check-hsa.sh")
403+
set(_tb_postinst_deb "${CMAKE_BINARY_DIR}/packaging/postinst")
404+
configure_file("${_tb_postinst_src}" "${_tb_postinst_deb}" COPYONLY)
405+
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${_tb_postinst_deb}")
406+
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${_tb_postinst_src}")
407+
397408
# TGZ — embed release tag so successive runs do not collide on the same key.
398409
# CMake 3.13+ honors CPACK_ARCHIVE_FILE_NAME for archive generators, but
399410
# CMake 3.22 (Ubuntu 22.04) falls back to CPACK_PACKAGE_FILE_NAME for TGZ.
@@ -414,7 +425,7 @@ else()
414425
rocm_setup_version(VERSION ${VERSION_STRING})
415426

416427
# Package specific CPACK vars
417-
rocm_package_add_dependencies(DEPENDS "numactl" "hsa-rocr")
428+
rocm_package_add_dependencies(DEPENDS "numactl")
418429

419430
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
420431
set(CPACK_RPM_PACKAGE_LICENSE "MIT")

packaging/postinst-check-hsa.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
# Advisory check used as both the DEB postinst and the RPM %post scriptlet.
3+
# TransferBench links against libhsa-runtime64.so.1; without it the binary
4+
# fails at first run with a dynamic-linker error. The relocatable package
5+
# declares no hard dep on hsa-rocr (or any ROCm component) because it is
6+
# expected to install on TheRock-tarball systems where no ROCm package is
7+
# tracked by apt/dpkg. Warn here so the user diagnoses a missing runtime
8+
# at install time, not at TransferBench launch.
9+
#
10+
# Always exits 0 — this is advisory, never fatal.
11+
12+
set -e
13+
14+
found=0
15+
16+
if command -v ldconfig >/dev/null 2>&1; then
17+
if ldconfig -p 2>/dev/null | grep -q 'libhsa-runtime64\.so\.1'; then
18+
found=1
19+
fi
20+
fi
21+
22+
if [ "$found" -eq 0 ]; then
23+
for d in /opt/rocm/lib /opt/rocm/lib64 /opt/rocm-*/lib /opt/rocm/extras-*/lib /opt/rocm/core-*/lib; do
24+
if [ -e "$d/libhsa-runtime64.so.1" ]; then
25+
found=1
26+
break
27+
fi
28+
done
29+
fi
30+
31+
if [ "$found" -eq 0 ]; then
32+
cat >&2 <<'EOF'
33+
====================================================================
34+
TransferBench: WARNING
35+
36+
libhsa-runtime64.so.1 was not found on the dynamic loader path or
37+
under any of /opt/rocm/lib, /opt/rocm-*/lib, or /opt/rocm/extras-*/lib.
38+
39+
TransferBench requires the ROCm HSA runtime at run time. Install a
40+
ROCm 7.x stack (system packages or TheRock SDK) before invoking
41+
TransferBench, or set LD_LIBRARY_PATH to a directory containing
42+
libhsa-runtime64.so.1.
43+
44+
Without it, TransferBench will fail at startup with:
45+
error while loading shared libraries: libhsa-runtime64.so.1
46+
====================================================================
47+
EOF
48+
fi
49+
50+
exit 0

0 commit comments

Comments
 (0)