[llvm] libclc: Pass LLVM_NATIVE_TOOL_DIR to runtime builds (PR #196498)

Konrad Kleine via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 01:04:29 PDT 2026


https://github.com/kwk updated https://github.com/llvm/llvm-project/pull/196498

>From 68b321c61c53911fb08bc34026a8aef699cdbce9 Mon Sep 17 00:00:00 2001
From: Fedora LLVM Team <llvm at fedoraproject.org>
Date: Fri, 24 Apr 2026 00:00:00 +0000
Subject: [PATCH] libclc: Pass LLVM_NATIVE_TOOL_DIR to runtime builds

This patch sets `LLVM_NATIVE_TOOL_DIR` in the runtime build
configuration to point to the directory containing the just-built LLVM
tools, allowing libclc to find them without requiring them to be
installed on the host system. If `LLVM_NATIVE_TOOL_DIR` is specified we
pass that on to the build.

Fixes build errors like:

```
  Error evaluating generator expression: $<TARGET_FILE:opt>
  No target "opt"
```

A few lines above this change, `extra_deps` list of dependencies for
libclc is created. But those tools don't get build in the runtime
build. We build libclc in the monolithic build and there we have all
the tools which is why I've added the path to discover the tools.
---
 llvm/runtimes/CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 1e074526d0f7c..3d359fb1d4916 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -582,6 +582,12 @@ if(build_runtimes)
         list(APPEND extra_deps ${dep})
       endif()
     endforeach()
+    # Pass the location of LLVM tools to the runtime build so libclc can find them
+    if (LLVM_NATIVE_TOOL_DIR)
+      list(APPEND extra_cmake_args "-DLLVM_NATIVE_TOOL_DIR=${LLVM_NATIVE_TOOL_DIR}")
+    else()
+      list(APPEND extra_cmake_args "-DLLVM_NATIVE_TOOL_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}")
+    endif()
   endif()
   # Tools needed by build_symbolizer.sh.
   if("compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES AND COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)



More information about the llvm-commits mailing list