Dear Maintainer,
clang-21 does not consider the LLVM 21 resource directory for the ROCm
device libs when ROCM_PATH is defined in the environment, unlike older
versions of LLVM (e.g., clang-17).
Various build systems will search for ROCm and then explicitly set the
ROCM_PATH during their build, which causes their builds to fail even if
the ROCM_PATH is correctly set.
To reproduce this problem consider:
apt install -y hipcc clang-21 rocm-device-libs-21
cat > main.hip << END
int main() { return 0; }
END
clang++-21 main.hip -lamdhip64 -o main # SUCCESS
ROCM_PATH=/usr clang++-21 main.hip -lamdhip64 -o main # FAIL
The failing output (with -v added) is:
Debian clang version 21.1.8 (1+b1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-21/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/15
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/15
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found HIP installation: /usr, version 6.4.43484
clang++-21: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
To resolve this problem, the LLVM resource directory should always be
considered when searching for the ROCm device libraries.
Sincerely,
Cory Bloor