[llvm] [libcxx] [ci] Make the CI find the right version of Clang-cl (PR #161736)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 14:13:06 PDT 2025
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/161736
We install a (or in practice, update a preexisting) copy of Clang, in order to get a specific version that we want. At that point in the procedure, this is the only version of Clang in the PATH.
However, the step of adding the MSVC build tools to the environment also ends up adding another copy of Clang, bundled with MSVC, into the PATH.
Due to this, CMake ends up finding and preferring the older version of Clang bundled with MSVC, rather than the one we intend to be used.
Manually add the directory of the version of Clang we want to use at the head of the search path, after initializing the MSVC build tool environment.
The directory name we add is a hardcoded guess of where it is installed - this is not ideal, but seems like the most straightforward solution for now.
>From 99d68f9e96f2d64ed40c98eb0c6fd2c48e653b53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Fri, 3 Oct 2025 00:00:24 +0300
Subject: [PATCH] [libcxx] [ci] Make the CI find the right version of Clang-cl
We install a (or in practice, update a preexisting) copy of Clang,
in order to get a specific version that we want. At that point
in the procedure, this is the only version of Clang in the PATH.
However, the step of adding the MSVC build tools to the environment
also ends up adding another copy of Clang, bundled with MSVC, into
the PATH.
Due to this, CMake ends up finding and preferring the older version
of Clang bundled with MSVC, rather than the one we intend to be
used.
Manually add the directory of the version of Clang we want to use at
the head of the search path, after initializing the MSVC build tool
environment.
The directory name we add is a hardcoded guess of where it is
installed - this is not ideal, but seems like the most
straightforward solution for now.
---
.github/workflows/libcxx-build-and-test.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 1c07a0adc6e99..77f79a85a0a2f 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -281,6 +281,10 @@ jobs:
- name: Set up the MSVC dev environment
if: ${{ matrix.mingw != true }}
uses: ilammy/msvc-dev-cmd at 0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
+ - name: Add the installed Clang at the start of the path
+ if: ${{ matrix.mingw != true }}
+ run: |
+ echo "c:\Program Files\LLVM\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
- name: Build and test
run: |
bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
More information about the llvm-commits
mailing list