Skip to content

ci(windows): drop static-lib + static-link guards — Plan C-d#69

Merged
chaploud merged 2 commits intomainfrom
develop/ci-windows-static-lib
Apr 29, 2026
Merged

ci(windows): drop static-lib + static-link guards — Plan C-d#69
chaploud merged 2 commits intomainfrom
develop/ci-windows-static-lib

Conversation

@chaploud
Copy link
Copy Markdown
Contributor

Summary

  • Replace system `cc` with `zig cc` in `test/c_api/run_static_link_test.sh`. `zig cc` is bundled with the Zig toolchain so the script no longer assumes a system C compiler — it works identically on macOS / Linux / Windows.
  • PIE coverage is preserved as a Linux-only branch (Mac never had it via the original `PIE_FLAG=""` no-op; that loophole is now an explicit SKIP).
  • Rust static-link sub-test stays SKIP on Windows because `examples/rust/build.rs` still emits `cargo:rustc-link-lib=c|m` and `-Wl,-rpath` — POSIX-only. Tracked as Plan C-c (separate PR).
  • Drop the two `if: runner.os != 'Windows'` guards on `Build static library` and `Run static link tests`.

Plan C-d. Plan C-a (#68) was the prior step. Five guards remaining: C-b, C-c, C-e, C-f, C-g.

Test plan

  • CI `test (windows-latest)`: new `Build static library` and `Run static link tests` steps green.
  • CI `test (ubuntu-latest)`: PIE branch exercised; Rust static-link sub-test runs (cargo present in matrix).
  • CI `test (macos-latest)`: zig cc + Rust paths green; PIE skipped.
  • Local Mac verified: `bash test/c_api/run_static_link_test.sh --build` → 2 PASS / 1 SKIP (PIE).
  • No new flakiness in subsequent runs (re-run if a single transient ETIMEDOUT).

`test/c_api/run_static_link_test.sh` now uses `zig cc` in place of
system `cc`, which is portable across Mac/Linux/Windows. PIE
coverage is preserved on Linux. The Rust static-link sub-test
(`cargo build` against the static lib) skips on Windows because
`examples/rust/build.rs` still emits `cargo:rustc-link-lib=c|m` and
`-Wl,-rpath` — those POSIX-isms are tracked as Plan C-c.

The two `if: runner.os != 'Windows'` guards on `Build static
library` and `Run static link tests` are dropped accordingly.
Zig's `addLibrary({.linkage = .static})` produces `zwasm.lib` on
Windows (MSVC convention, no `lib` prefix), not `libzwasm.a`. Detect
host OS and pick the right path.

Mac/Linux paths unchanged.
@chaploud chaploud merged commit 8fd36ab into main Apr 29, 2026
6 checks passed
@chaploud chaploud deleted the develop/ci-windows-static-lib branch April 29, 2026 01:47
chaploud added a commit that referenced this pull request Apr 29, 2026
chaploud added a commit that referenced this pull request Apr 29, 2026
`examples/rust/build.rs` gained a Windows arm:

- Dynamic linking copies `zwasm.dll` from `zig-out/bin/` next to the
  cargo target binary so the OS finds it via the executable
  directory at runtime. PE has no analogue of `-Wl,-rpath`.
- Static linking uses `zwasm.lib` (not `libzwasm.a`) and skips the
  POSIX-only `-lc` / `-lm` (Windows MSVC auto-links the CRT).

The `if: runner.os != 'Windows'` guard on the `Run Rust FFI example
(dynamic)` step is dropped accordingly.

Plan C-c. Mac/Linux paths unchanged. The static-link Rust sub-test
in `test/c_api/run_static_link_test.sh` is still SKIP'd on Windows
in PR #69; un-skipping it once both PRs land is a follow-up.
chaploud added a commit that referenced this pull request Apr 29, 2026
`examples/rust/build.rs` gained a Windows arm:

- Dynamic linking copies `zwasm.dll` from `zig-out/bin/` next to the
  cargo target binary so the OS finds it via the executable
  directory at runtime. PE has no analogue of `-Wl,-rpath`.
- Static linking uses `zwasm.lib` (not `libzwasm.a`) and skips the
  POSIX-only `-lc` / `-lm` (Windows MSVC auto-links the CRT).

The `if: runner.os != 'Windows'` guard on the `Run Rust FFI example
(dynamic)` step is dropped accordingly.

Plan C-c. Mac/Linux paths unchanged. The static-link Rust sub-test
in `test/c_api/run_static_link_test.sh` is still SKIP'd on Windows
in PR #69; un-skipping it once both PRs land is a follow-up.
chaploud added a commit that referenced this pull request Apr 29, 2026
…fresh (#77)

- CHANGELOG.md [Unreleased]: tag the Plan C-a/b/c/d/e/f and W52
  entries with their PR numbers (#68/#69/#71/#70/#72/#74) so the
  next /release roll-up has authoritative provenance; add D137 to
  the Internal section (cross-platform stripping + per-OS size
  ceilings, recorded post-#73); add one-line entries for the
  doc-alignment sweep (#75) and the obsolete-checklist drop (#76).
- .dev/memo.md ## Current Task: append #74/#75/#76 to the post-
  morning PR list (was "Six new PRs", now "Nine"); replace the
  "in flight: #74" paragraph with #74 in the merged list; bump
  bench-record range to #68..#76. The "Plan B sub-3 / W50 still
  pending" pointer through resume-guide.md remains intact.

No behaviour change. Doc-only.
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