hip-config.cmake contains wrong paths when not using /opt/rocm/
This issue comes up when rocm is installed in system directories and not /opt/rocm, for example Fedora package by @Mystro256 and Solus package I have done.
When building something relying on hip (in my case rocblas), hip-config.cmake causes problems. Ones I currently found are:
_IMPORT_PREFIX:${_IMPORT_PREFIX}/../includewill mean that it will point to/usr/../includewhich doesn't exist. Changing all the occurrences to${_IMPORT_PREFIX}/includeit now correctly points to/usr/includeHIP_CLANG_ROOT: When using system's LLVM${ROCM_PATH}/llvmwill not find the correct folders in system directories, like for example it then looks for${ROCM_PATH}/llvm/clang, and the folder it is looking for is/usr/lib64/clang. So you can't simply set${ROCM_PATH}, you need to correct this .cmake file too. I had to change${ROCM_PATH}/llvmto/usr.
Here is the generated hip-config.cmake that is problematic for me (in /usr/lib64/cmake/hip/).
And to fix it I did:
sed -i 's|${_IMPORT_PREFIX}/../include|${_IMPORT_PREFIX}/include|g' /usr/lib64/cmake/hip/hip-config.cmake
sed -i 's|"${ROCM_PATH}/llvm"|"/usr"|g' /usr/lib64/cmake/hip/hip-config.cmake
Hi, you might need this clang patch:
https://src.fedoraproject.org/rpms/clang/pull-request/156
As I said in the other thread, I would copy the Debian packaging w.r.t. hip, as I've been focusing on functional openCL in the short-term. We've been working with them closely.
On May 25, 2022 11:13:26 a.m. EDT, Jacek Jagosz @.***> wrote:
This issue comes up when rocm is installed in system directories and not
/opt/rocm, for example Fedora package by @Mystro256 and Solus package I have done. When building something relying on hip, in my caserocblaship-config.cmakecauses problems. Ones I currently found are:-- Reply to this email directly or view it on GitHub: https://github.com/ROCm-Developer-Tools/hipamd/issues/27 You are receiving this because you were mentioned.
Message ID: @.***>
Unfortunately I was using this patch already, and it even got merged in LLVM 14.0.4. With or without this patch the result was the same. I will definitely go through Debian package and see how they do it, thank you for recommendation, up to this point I have only looked at Fedora and Arch. For now in Solus it also only focuses on OpenCL support, but I try to package more, hope my findings can help Debian or Fedora packagers when they get to it.