[PATCH] clc: find opencl headers from the installed llvm/clang location
authorLionel Landwerlin <llandwerlin@gmail.com>
Wed, 19 Jun 2024 20:52:57 +0000 (23:52 +0300)
committerTimo Aaltonen <tjaalton@debian.org>
Fri, 20 Sep 2024 18:57:00 +0000 (21:57 +0300)
A number of people report the headers not being found when running
intel-clc. I've run into the same issue but only on the most recent
Ubuntu version.

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
Gbp-Pq: Name clc-find-opencl-headers.diff

src/compiler/clc/clc_helpers.cpp

index 346a811386d48db4c402542dfcf73b3255496e98..9cafc88103777517d22b28f6f0d702a8a625e67a 100644 (file)
@@ -906,6 +906,12 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
    c->getHeaderSearchOpts().AddPath(clang_res_path.string(),
                                     clang::frontend::Angled,
                                     false, false);
+
+   auto clang_install_res_path =
+      fs::path(LLVM_LIB_DIR) / "clang" / std::to_string(LLVM_VERSION_MAJOR) / "include";
+   c->getHeaderSearchOpts().AddPath(clang_install_res_path.string(),
+                                    clang::frontend::Angled,
+                                    false, false);
 #endif
 
    // Enable/Disable optional OpenCL C features. Some can be toggled via `OpenCLExtensionsAsWritten`