Hi Spaarsh,
I am trying to enable ROCm in dbcsr[1] and one of the dependencies is
libamdhip64-dev since it contains the hip-config.cmake file. When I try to
build my package, it fails with the following error message:
```
-- The HIP compiler identification is unknown
CMake Error at
/usr/share/cmake-3.31/Modules/CMakeDetermineHIPCompiler.cmake:217 (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
/usr/lib64/cmake/hip-lang/hip-lang-config.cmake
Call Stack (most recent call first):
CMakeLists.txt:277 (enable_language)
```
[....]
I am not entirely sure if this is a `libamdhip64-dev` bug or something related
to `CMake`.
My dbcsr fork can be found here[2] and I am using a docker container.
I noticed in your d/rules file that you have specified:
export HIPCC=$(shell which hipcc)
<...>
-DCMAKE_HIP_COMPILER=${HIPCC}
However, this is not a valid value for CMAKE_HIP_COMPILER. There are two
ways of building HIP programs with CMake:
1. Specifying hipcc as the CMAKE_CXX_COMPILER (typically via the CXX
environment variable)
2. Specifying clang++ as the CMAKE_HIP_COMPILER (typically via the
HIPCXX environment variable)
To find out which of the two methods is used for building any particular
library, you should read the library's build instructions. Although, in
this case we know that dbcsr uses (2) because that's the method that
uses hip-lang-config.cmake.
In any case, the point is that it is not valid to specify hipcc as the
CMAKE_HIP_COMPILER. You must have the hipcc package installed for both
methods 1 and 2 because the hipcc package provides hipconfig, but clang
is the only compiler that CMake recognizes as being a HIP compiler.
On each version of Debian, there are a few different versions of clang
that are made available. However, only one of them is used for HIP. On
Debian Trixie and Debian Unstable, that is currently clang++-17.
I would suggest adding
export HIPCXX=clang++-17
then deleting
-DCMAKE_HIP_COMPILER=${HIPCC}
and also deleting
-DCMAKE_HIP_COMPILER_ROCM_ROOT=/usr
Sincerely,
Cory Bloor