From 21d2cd97598e367813bbfff2e471450871d49b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= Date: Mon, 27 Apr 2026 11:11:40 +0200 Subject: [PATCH] gnu: rocm-hip-runtime: Fix incorrect 'HIP_PATH' location for `hipconfig'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/llvm.scm (rocm-hipcc): Adjust wrapper so 'HIP_PATH' can be overriden. [phases]: Adjust 'wrap-programs' phase for making wrapped binaries respect HIP_PATH environment variable. * gnu/packages/rocm.scm (rocm-hip-runtime): Re-wrap programs taken from `rocm-hipcc' so their paths point to this package output. [phases]: Add 'wrap-programs' phase to force 'HIP_PATH' to point to the package output. Fixes: #6821 Change-Id: I877b1f3b3dda1ebc00caf5ef1c729914efa6de94 Signed-off-by: Ludovic Courtès Merges: #8181 --- gnu/packages/llvm.scm | 5 ++++- gnu/packages/rocm.scm | 13 ++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index d870901c56a..2bb93a74f7b 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -1621,7 +1621,10 @@ AMDGPU code objects.") ;; #$rocm-hip-runtime. ;;(list "HIP_ROCCLR_HOME" '= (list #$rocm-hip-runtime)) - (list "HIP_PATH" '= (list #$output)) + + ;; HACK: allow `rocm-hip-runtime' to wrap this program + ;; with its own `HIP_PATH'. + (list "HIP_PATH" '= (list (string-append "${HIP_PATH:-" #$output "}"))) (list "HIP_CLANG_PATH" '= (list (string-append diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index c1129e67ac7..0a0e152bf82 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -225,7 +225,18 @@ and in-process/in-memory compilation.") (("LLVM_DIR=\"\\$4\"") "LLVM_DIR=\"$4\"; CLANG_DIR=\"$5\";") (("\\$LLVM_DIR/bin/clang") - (string-append "$CLANG_DIR/bin/clang")))))))) + (string-append "$CLANG_DIR/bin/clang"))))) + ;; Re-wrap programs taken from `rocm-hipcc' so their paths point to + ;; this package output. + (add-after 'install 'wrap-programs + (lambda _ + (let ((output-bindir (string-append #$output "/bin"))) + (for-each + (lambda (file) + (wrap-program (string-append output-bindir "/" file) + `("HIP_PATH" = ,(list #$output)) + `("PATH" suffix ,(list output-bindir)))) + '("hipcc" "hipconfig")))))))) (inputs (list glew mesa