When using the amdclang compiler through a wrapper script called "clang", HIP's cmake throws an error because it cannot find libclang_rt.builtins.
I think the source of the error is in a combination of:
https://github.com/ROCm-Developer-Tools/hipamd/blob/develop/hip-config.cmake.in
and https://github.com/ROCm-Developer-Tools/HIP/blob/develop/hip-lang-config.cmake.in
The reason that I am unsure is that the error is coming from this file in my system:
/opt/rocm-5.4.0/lib/cmake/hip/hip-config.cmake
It contains both
if(HIP_COMPILER STREQUAL "clang")
if(WIN32)
and, later in the same file,
file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_CLANG_ROOT}/lib/clang/*/lib/*")
find_library(CLANGRT_BUILTINS
NAMES
clang_rt.builtins
clang_rt.builtins-x86_64
PATHS
${HIP_CLANGRT_LIB_SEARCH_PATHS}
${HIP_CLANG_INCLUDE_PATH}/../lib/linux
${HIP_CLANG_INCLUDE_PATH}/../lib/windows
NO_DEFAULT_PATH)
The actual path to the library it's looking for on my system is
/opt/rocm-5.4.0/llvm/lib/clang/15.0.0/lib/linux/libclang_rt.builtins-x86_64.a
IMHO, resolving this issue properly requires defining and enforcing a consistent convention for rocm, llvm, and clang paths. These paths are a recurring issue in many components of rocm. A consistent convention stands to fix a lot of related troubles.