Skip to content

Improve clang-cl discovery for Windows ARM64 builds#1060

Merged
justsmth merged 2 commits intoaws:mainfrom
justsmth:fix-windows-arm-c1
Apr 15, 2026
Merged

Improve clang-cl discovery for Windows ARM64 builds#1060
justsmth merged 2 commits intoaws:mainfrom
justsmth:fix-windows-arm-c1

Conversation

@justsmth
Copy link
Copy Markdown
Contributor

@justsmth justsmth commented Mar 10, 2026

Issues:

Addresses #1056

Description of changes:

On aarch64-pc-windows-msvc, the cc_builder requires clang-cl instead of MSVC's cl.execl.exe can't handle .S ARM assembly files or several clang-style C flags we rely on. Previously, the build script only looked for clang-cl on PATH. If it wasn't there (e.g., building from a regular shell rather than a VS Developer Shell), the build would silently fall through to cl.exe and fail with a wall of inscrutable warnings and a linker error about missing .o files.

This change has the build script discover clang-cl inside the Visual Studio installations by leveraging the cc crate's existing VS toolchain discovery. If clang-cl isn't on PATH, we locate cl.exe through cc::windows_registry, walk up to the VS root, and probe for VC\Tools\Llvm\{ARM64,x64}\bin\clang-cl.exe. The result is cached via OnceLock to avoid redundant work across check_dependencies and build calls.

When clang-cl can't be found at all, the cc_builder now emits an actionable warning telling the user to install the "C++ Clang Compiler for Windows" VS component before the build fails.

Call-outs:

  • The cmake_builder already handles this differently — it uses generator_toolset("ClangCL") which tells CMake's VS generator where to find clang-cl. The cmake_builder change here just moves the clang-cl dependency check out of the nasm-specific block so it applies independently.
  • We intentionally don't fail the cc_builder's check_dependencies when clang-cl is missing. Doing so would cause get_builder to fall through to CmakeBuilder, which would produce a misleading "Missing dependency: cmake" error for users who don't have CMake installed.

Testing:

CI job (build-clang-cl-discovery-test) on windows-11-arm that removes clang-cl from PATH and verifies the build still succeeds via the fallback discovery path.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.65%. Comparing base (c358484) to head (670f444).
⚠️ Report is 366 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1060      +/-   ##
==========================================
- Coverage   95.80%   92.65%   -3.15%     
==========================================
  Files          61       71      +10     
  Lines        8143    10149    +2006     
  Branches        0    10149   +10149     
==========================================
+ Hits         7801     9404    +1603     
- Misses        342      452     +110     
- Partials        0      293     +293     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth justsmth force-pushed the fix-windows-arm-c1 branch 2 times, most recently from 7dd8643 to d7aa1fe Compare March 18, 2026 15:00
@justsmth justsmth force-pushed the fix-windows-arm-c1 branch 2 times, most recently from e689cb0 to d211d9b Compare April 13, 2026 20:50
@justsmth justsmth changed the title [DRAFT] Improve Windows/ARM build support Improve clang-cl discovery for Windows ARM64 builds Apr 13, 2026
@justsmth justsmth marked this pull request as ready for review April 13, 2026 20:59
@justsmth justsmth requested a review from a team as a code owner April 13, 2026 20:59
@justsmth justsmth force-pushed the fix-windows-arm-c1 branch from d211d9b to 72cb4d8 Compare April 13, 2026 21:18
@justsmth justsmth force-pushed the fix-windows-arm-c1 branch from 72cb4d8 to 670f444 Compare April 14, 2026 13:48
@justsmth justsmth merged commit 64677e8 into aws:main Apr 15, 2026
556 of 563 checks passed
@justsmth justsmth deleted the fix-windows-arm-c1 branch April 15, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants