diff --git a/cmake/FindCompiler.cmake b/cmake/FindCompiler.cmake index 265719bf0..556211999 100644 --- a/cmake/FindCompiler.cmake +++ b/cmake/FindCompiler.cmake @@ -69,4 +69,15 @@ if(is_dpcpp) INTERFACE_LINK_LIBRARIES ${SYCL_LIBRARY}) endif() -endif() + if(ENABLE_ROCBLAS_BACKEND OR ENABLE_ROCRAND_BACKEND OR ENABLE_ROCSOLVER_BACKEND) + # Allow find_package(HIP) to find the correct path to libclang_rt.builtins.a + # HIP's CMake uses the command `${HIP_CXX_COMPILER} -print-libgcc-file-name --rtlib=compiler-rt` to find this path. + # This can print a non-existing file if the compiler used is icpx. + if(NOT HIP_CXX_COMPILER) + find_path(HIP_CXX_COMPILER clang++ + HINTS ENV HIPROOT ENV ROCM_PATH + ) + endif() + endif() + +endif(is_dpcpp) diff --git a/docs/building_the_project_with_dpcpp.rst b/docs/building_the_project_with_dpcpp.rst index 365028237..40ac91ea8 100644 --- a/docs/building_the_project_with_dpcpp.rst +++ b/docs/building_the_project_with_dpcpp.rst @@ -457,11 +457,14 @@ Build FAQ clangrt builtins lib not found Encountered when trying to build oneMKL with some ROCm libraries. There are - several possible solutions: * If building Open DPC++ from source, add - ``compiler-rt`` to the external projects compile option: - ``--llvm-external-projects compiler-rt``. * The *clangrt* from ROCm can be - used, depending on ROCm version: ``export - LIBRARY_PATH=/path/to/rocm-$rocm-version$/llvm/lib/clang/$clang-version$/lib/linux/:$LIBRARY_PATH`` + several possible solutions: + + * If building Open DPC++ from source, add ``compiler-rt`` to the external + projects compile option: ``--llvm-external-projects compiler-rt``. + * Manually set the variable ``HIP_CXX_COMPILER`` to HIP's toolkit ``clang++`` + path, for instance ``-DHIP_CXX_COMPILER=/opt/rocm/6.1.0/llvm/bin/clang++``. + oneMKL may fail to link if the clang versions of ``icpx`` and ``rocm`` are + not compatible. Could NOT find CBLAS (missing: CBLAS file) Encountered when tests are enabled along with the BLAS domain. The tests