diff --git a/Misc/NEWS.d/next/Build/2025-09-03-14-55-59.gh-issue-138451.-Qzh2S.rst b/Misc/NEWS.d/next/Build/2025-09-03-14-55-59.gh-issue-138451.-Qzh2S.rst new file mode 100644 index 00000000000000..46cc6ffc05ea2d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-09-03-14-55-59.gh-issue-138451.-Qzh2S.rst @@ -0,0 +1 @@ +Search for LLVM tools in ``LLVM_TOOLS_INSTALL_DIR`` during the build. diff --git a/Tools/jit/_llvm.py b/Tools/jit/_llvm.py index f09a8404871b24..b714b9d810f9e5 100644 --- a/Tools/jit/_llvm.py +++ b/Tools/jit/_llvm.py @@ -69,6 +69,11 @@ async def _get_brew_llvm_prefix(*, echo: bool = False) -> str | None: @_async_cache async def _find_tool(tool: str, *, echo: bool = False) -> str | None: + # Explicitly defined LLVM installation location + if llvm_tools_dir := os.getenv("LLVM_TOOLS_INSTALL_DIR"): + path = os.path.join(llvm_tools_dir, tool) + if await _check_tool_version(path, echo=echo): + return path # Unversioned executables: path = tool if await _check_tool_version(path, echo=echo):