Skip to content

fix(ci): satisfy the phantom xml2s.lib the LLVM Windows tarball demands - #7418

Merged
proggeramlug merged 2 commits into
mainfrom
fix/windows-xml2s-stub
Aug 5, 2026
Merged

fix(ci): satisfy the phantom xml2s.lib the LLVM Windows tarball demands#7418
proggeramlug merged 2 commits into
mainfrom
fix/windows-xml2s-stub

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Windows CI cannot link llvm-sys at all. native-roots-rs4gc (windows-latest) dies at the build step, and test.yml's windows-build fails identically — so this unblocks Windows CI generally, not just one arm.

LINK : fatal error LNK1181: cannot open input file 'xml2s.lib'

Root cause: a phantom dependency baked into LLVM's own release

LLVM's build_llvm_release.bat builds a static libxml2 into a scratch directory and points CMake at it:

-DLLVM_ENABLE_LIBXML2=FORCE_ON
-DLIBXML2_LIBRARIES=%libxmldir%/lib/libxml2s.lib

%libxmldir% is never installed, so the published clang+llvm-*-pc-windows-msvc tarball carries the dependency but not the library. llvm-config --system-libs --link-static reports xml2s.lib; llvm-sys forwards every system lib verbatim to cargo:rustc-link-lib; link.exe fails before resolving a single symbol.

The failing link line contains "ntdll.lib" "xml2s.lib" in exactly the --system-libs position with /LIBPATH:C:\llvm\lib present — the file is genuinely absent and the linker searched for it.

llvm-sys has no filtering knob. Its only env vars are LLVM_SYS_221_{PREFIX,IGNORE_BLOCKLIST,STRICT_VERSIONING,NO_CLEAN_CFLAGS,USE_DEBUG_MSVCRT,FFI_WORKAROUND} — refuting the "there's usually a way to skip optional system libs" assumption I started from.

Not caused by the recent LLVM work

#7388 touched only the Linux arm (zero Windows-related lines). The Windows arm is unchanged since #7353, which made the in-process backend default and statically linked — before that, nothing on Windows linked llvm-sys. Latent since then, and invisible because three of four arms in that matrix never executed until #7393.

The fix

Windows arm only: when llvm-config reports xml2s.lib and the libdir lacks it, synthesize an empty archive there (clang-cl /c on a one-symbol stub, then llvm-lib /OUT:), with hard failure checks on both tools and both outputs.

Both conditions are deliberate so the block self-deletes: if a future release ships libxml2 or stops reporting it, this becomes a no-op rather than fabricating over the real library.

Confidence, stated honestly

Diagnosis: high — the link line, the upstream script, and the llvm-sys source agree.

Fix: moderate. I cannot test Windows locally. Two unverified assumptions, both with loud falsifiers:

  1. An empty archive suffices — inside LLVM, libxml2 is reachable only from LLVMWindowsManifest (lld-link, llvm-mt); the LLVM-C surface inkwell drives never touches it. Falsifier: LNK2019 unresolved externals on xml* symbols. It cannot quietly mask a real dependency.
  2. clang-cl.exe and llvm-lib.exe ship in the tarball — both are standard install targets, and the tarball is a full install (proven by llvm-config.exe being present). Falsifier: the explicit "missing from the LLVM tarball" error added here.

Rejected alternative: vcpkg install libxml2:x64-windows-static — sound, but builds libxml2 and deps from source on every Windows job across 18 workflows.

Ralph Küpper added 2 commits August 5, 2026 07:34
LLVM's official Windows release script builds a static libxml2 into a
scratch directory and points cmake at it with -DLLVM_ENABLE_LIBXML2=FORCE_ON
-DLIBXML2_LIBRARIES=%libxmldir%/lib/libxml2s.lib. %libxmldir% is never
installed, so the published clang+llvm-*-pc-windows-msvc tarball carries the
dependency but not the library. llvm-config --system-libs --link-static
reports xml2s.lib, llvm-sys forwards every system lib verbatim with no knob
to filter one out, and link.exe dies with LNK1181 before resolving a symbol.

Synthesize an empty archive at the LLVM libdir when llvm-config reports
xml2s.lib AND the libdir lacks it. It is a name dependency, not a symbol
dependency: libxml2 is reachable only from LLVMWindowsManifest, which the
LLVM-C surface inkwell drives never touches, and rustc bundles the component
archives into libllvm_sys.rlib where link.exe pulls members lazily. If that
stops being true the link fails loudly with LNK2019 rather than silently
dropping manifest support. Checking both conditions makes the workaround
self-deleting once a release ships or stops reporting the library.

Latent since #7353 made the in-process LLVM backend the default and
statically linked, not caused by #7388 (which touches only the Linux arm).
It became visible when #7393's concurrency group let gc-native-roots.yml's
windows-latest arm reach a runner for the first time. Fixing it in the
composite action also unblocks test.yml's windows-build.

Claude-Session: https://claude.ai/code/session_019EHcmXKArA7m42SihYCcgH
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@proggeramlug, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a5989ba-b9f3-4e3d-b237-0e5e5fd9458a

📥 Commits

Reviewing files that changed from the base of the PR and between e1c564d and 1253811.

📒 Files selected for processing (2)
  • .github/actions/setup-llvm22/action.yml
  • changelog.d/7418-windows-xml2s-stub.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit 73761eb into main Aug 5, 2026
10 of 12 checks passed
@proggeramlug
proggeramlug deleted the fix/windows-xml2s-stub branch August 5, 2026 05:35
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.

1 participant