HIP: CMake does not search lib64 for hip-lang-config.cmake
There is a mismatch between where CMake looks for hip-lang-config.cmake
and where that file is installed on Fedora and Fedora-derived distros.
What was done
In a fresh Fedora Rawhide container:
dnf -y update
dnf -y install rocm-hip-devel rocm-comgr-devel hsakmt-devel rocm-runtime-devel cmake lld clang clang-libs clang-resource-filesystem clang-tools-extra llvm
cat << 'EOF' > main.hip
#include <hip/hip_runtime.h>
int main() {
return 0;
}
EOF
cat << 'EOF' > CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
project(example LANGUAGES HIP)
add_executable(ex main.hip)
EOF
cmake -S. -Bbuild --debug-output
What was seen
-- The HIP compiler identification is Clang 16.0.5
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[2] /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake
[1] /root/CMakeLists.txt
CMake Error at /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake:140 (message):
The ROCm root directory:
/usr
does not contain the HIP runtime CMake package, expected at one of:
/usr/lib/cmake/hip-lang/hip-lang-config.cmake
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
Called from: [2] /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake
[1] /root/CMakeLists.txt
-- Configuring incomplete, errors occurred!
At the moment, Fedora Rawhide is using cmake version 3.27.0-rc3.
Discussion
The package rocm-hip-devel
provides /usr/lib64/cmake/hip-lang/hip-lang-config.cmake
, however, this file is not found by the search. This is a similar problem to #24562 (closed).