Skip to content

fix(ci): build vendored OpenSSL on Windows so webauthn-rs links (#6161)#6163

Merged
houko merged 2 commits into
mainfrom
fix/6161-windows-openssl
Jun 17, 2026
Merged

fix(ci): build vendored OpenSSL on Windows so webauthn-rs links (#6161)#6163
houko merged 2 commits into
mainfrom
fix/6161-windows-openssl

Conversation

@houko

@houko houko commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

main is red on the Windows test lane.
PR #6129 / #5981 (passkey, WebAuthn) added webauthn-rs, which pulls in webauthn-rs-core and through it the native openssl-sys crate.
On the Windows MSVC CI runners there is no discoverable system OpenSSL and the vendored build was not enabled, so the workspace test build fails with:

Could not find directory of OpenSSL installation, and this -sys crate cannot proceed.

Linux and macOS runners ship a probed system OpenSSL, so they are unaffected — the failure is Windows-only.
Failing run: https://github.com/librefang/librefang/actions/runs/27675199468

Fix

Add a cfg(windows)-gated dependency to crates/librefang-api/Cargo.toml that enables the vendored OpenSSL build:

[target.'cfg(windows)'.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

Cargo feature-unification then makes openssl-sys build from vendored source on Windows only.
Unix targets keep using the fast system library already present in CI — the cfg(windows) gate means nothing changes for Linux/macOS.
The dependency is added to the existing [target.'cfg(windows)'.dependencies] table (which already carries windows-sys), not a duplicate table.
version = "0.10" matches the openssl 0.10.81 already resolved in Cargo.lock.

Why no NASM / Perl setup step

The vendored builder is openssl-src. It auto-detects whether nasm.exe is on PATH: if present it enables the assembly routines, if absent it configures no-asm and builds without them rather than failing (OPENSSL_RUST_USE_NASM left unset → auto-detect).
So the absence of NASM on the GitHub Windows runner images is not a build blocker.
Both windows-2022 and windows-2025 runner images ship Perl (5.32.1 / 5.42.0), which is the only host prerequisite the vendored build actually needs.
This keeps the change to a single line — no new CI install step. (I verified the test-windows job in .github/workflows/ci.yml has no existing nasm/perl setup step and confirmed against the actions/runner-images readmes that Perl is preinstalled and NASM is not.)

Changes

  • crates/librefang-api/Cargo.toml: add cfg(windows)-gated openssl = { version = "0.10", features = ["vendored"] } with an explanatory comment.
  • Cargo.lock: regenerated — adds openssl-src 300.6.1+3.6.3 as a dependency of openssl-sys, and openssl as a direct dep of librefang-api. The lockfile is target-agnostic, so the cfg(windows) dep resolves and locks even on a Linux host.
  • CHANGELOG.md: one ### Fixed bullet under [Unreleased].
  • .secrets.baseline: line-number refresh emitted by the detect-secrets pre-commit hook (an existing already-baselined CHANGELOG entry shifted down 6 lines); no new secret.

Verification

This host has no native cargo, so verification ran through the repo's sanctioned librefang-rust-dev Docker image (Linux), using a per-worktree target volume + the shared download volume, exactly as CLAUDE.md (“Verifying without a native toolchain”) prescribes:

docker build -t librefang-rust-dev:latest -f Dockerfile.rust-dev .

WORKTREE="$(git rev-parse --show-toplevel)"
TARGET_VOL="librefang-target-$(basename "$WORKTREE")"
docker run --rm \
  -v "$WORKTREE":/work \
  -v librefang-cargo:/cargo -v "$TARGET_VOL":/target \
  -e CARGO_HOME=/cargo -e CARGO_TARGET_DIR=/target -w /work \
  librefang-rust-dev:latest \
  sh -c 'export PATH=/usr/local/cargo/bin:$PATH; cargo check -p librefang-api'
# → Finished `dev` profile in 1m 12s (updated Cargo.lock with openssl-src)

Results:

  • cargo check -p librefang-api — clean (Finished in ~1m12s); this regenerated Cargo.lock.
  • cargo check -p librefang-api --locked — clean, no further lockfile changes (Finished in 0.26s), confirming Cargo.lock is --locked-clean.
  • cargo check --workspace --lib --locked — clean (Finished in ~1m05s).

No .rs files were touched, so cargo fmt was not required.

The container is Linux-only and cannot compile the cfg(windows) branch, so it does not itself exercise the vendored OpenSSL build — but the lockfile resolution above proves the dependency graph is correct, and the fix is the standard MSVC remedy for an openssl-sys link failure.

CI nuance

The Windows test lane (test-windows in .github/workflows/ci.yml) runs only on push to main and in the merge queue (github.event_name == 'push' || 'merge_group') — it does not run on pull requests, and there is no workflow_dispatch or label to trigger it on a PR.
So this PR's own CI will not exercise Windows.
If the repo merges through a merge queue, the merge_group event will run the Windows job before this lands on main; otherwise the first Windows validation happens on the post-merge main push.
Either way the fix is the canonical vendored-OpenSSL remedy and has been validated by dependency-graph resolution + the Docker Linux checks above.

Closes #6161.

The passkey/WebAuthn work (#5981) added webauthn-rs, which pulls in webauthn-rs-core and its native openssl-sys link. Windows MSVC CI runners have no discoverable system OpenSSL, so the workspace test build fails there with "Could not find directory of OpenSSL installation, and this -sys crate cannot proceed". Linux and macOS runners ship a probed system OpenSSL and are unaffected.

Add a cfg(windows)-gated openssl = { features = ["vendored"] } dependency to crates/librefang-api so cargo feature-unification builds openssl-sys from source on Windows only; Unix keeps using the fast system library. No NASM setup step is needed: the vendored builder (openssl-src) auto-detects nasm and falls back to a no-asm build when it is absent, and both Windows runner images already ship the Perl the build requires.

Closes #6161.
@github-actions github-actions Bot added size/S 10-49 lines changed area/docs Documentation and guides labels Jun 17, 2026
@houko
houko merged commit 620f865 into main Jun 17, 2026
33 checks passed
@houko
houko deleted the fix/6161-windows-openssl branch June 17, 2026 12:17
houko added a commit that referenced this pull request Jun 17, 2026
…lane (#6171)

* fix(ci): pin vendored OpenSSL to Strawberry Perl on the Windows test lane

#6163 added a Windows-gated vendored `openssl-sys` so `webauthn-rs` links, on the assumption the runner's bundled Perl would build it. That assumption only holds outside Git Bash.

The `Test / Windows` job runs `cargo nextest` under `shell: bash`, which prepends the MSYS toolchain to `PATH`, so `openssl-src` resolves `perl` to Git Bash's `/usr/share/perl5/core_perl` instead of Strawberry Perl. That Perl cannot configure OpenSSL's `VC-WIN64A` build — its `IPC::Cmd` / `Params::Check` modules fail to compile and `./Configure` aborts, failing both shards with exit code 101.

#6163's own CI never caught this because the Windows test lane is main-push-only and does not run on PRs, so the break only surfaced after merge to `main`.

Set `OPENSSL_SRC_PERL` (openssl-src's documented Perl override, ahead of `PERL` and the bare `perl` fallback) to the runner's Windows-native `C:/Strawberry/perl/bin/perl.exe` on the test step. NASM is unaffected — the failing Configure args carried no `no-asm`, so the runner's `nasm` was already detected.

The release Windows jobs need no change: their `cargo build` step runs under the default `pwsh`, where the system `PATH` resolves `perl` to Strawberry directly.

Refs #6161.

* fix(ci): correct CHANGELOG PR ref and trim multi-line comment block

---------

Co-authored-by: Evan <[email protected]>
Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation and guides size/S 10-49 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[main red] CI failure on PR #6129

2 participants