Fix cargo install --locked wasixcc, release 0.4.5 - #73
Merged
Conversation
`.cargo/config.toml` was committed, so cargo auto-discovered the WASIX overlay registry for *every* invocation. Source replacement records the replaced source id, which left Cargo.lock pinning 14 `X.Y.Z+wasix.N` versions that claim to come from crates.io and don't exist there. The lockfile ships inside the published .crate, so `cargo install --locked wasixcc` failed outright and `cargo vendor` broke downstream. The native release tarballs were also being built against forked libc/ring/tokio. Move the overlay to wasix/registry.toml, passed explicitly via `cargo --config` by the new Makefile, which swaps Cargo.wasix.lock in around the WASIX build and always restores the crates.io Cargo.lock. Most of the fork surface existed only for src/download.rs, whose networking is dead code inside the Wasmer package (clang and the sysroot come from wasmer/clang). Put it behind a default-on `download` feature and build WASIX with --no-default-features. Also drop five unused direct deps and stop rustls' default features from compiling ~18MB of aws-lc-sys that download.rs never uses — it installs the ring provider explicitly. CI now fails if a cargo config is tracked or Cargo.lock mentions +wasix, and release builds and publishes with --locked. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes cargo install --locked wasixcc failures by preventing the WASIX overlay registry configuration from “poisoning” the published Cargo.lock, while keeping WASIX builds reproducible via an explicit opt-in config and a separate WASIX lockfile.
Changes:
- Move WASIX overlay registry config out of
.cargo/intowasix/registry.toml, applied explicitly for WASIX builds (viacargo --config). - Introduce a
downloadfeature (default-on) to gate the download/TLS stack; WASIX builds use--no-default-features. - Add Makefile targets and CI checks to enforce lockfile hygiene and use
--lockedconsistently in release/build workflows.
Reviewed changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
wasmer.toml |
Bumps published Wasmer package version to 0.4.5. |
wasix/registry.toml |
Adds explicit opt-in WASIX overlay registry config. |
src/wasixccenv.rs |
Gates download subcommands/exports behind the download feature. |
src/main.rs |
Compiles the download module only when the download feature is enabled. |
src/args.rs |
Adjusts user-facing LLVM/binaryen hints based on download feature. |
README.md |
Documents native and WASIX build flows and the overlay/lockfile rationale. |
Makefile |
Adds make wasix* targets and guardrails to keep overlay opt-in. |
installer/public/install.sh |
Bumps installer version to 0.4.5. |
Cargo.wasix.lock |
Adds a dedicated lockfile intended for WASIX overlay builds. |
Cargo.toml |
Bumps version and introduces download feature + optional download deps. |
Cargo.lock |
Regenerates crates.io lockfile without +wasix overlay versions. |
.gitignore |
Ignores /.cargo/ and the Makefile’s scratch lock backup. |
.github/workflows/release.yml |
Adds a pre-publish guard and publishes with --locked. |
.github/workflows/pr-checks.yml |
Adds a lockfile-hygiene job and checks --no-default-features. |
.github/workflows/build-release-bundle.yml |
Builds release artifacts with --locked. |
.cargo/config.toml |
Removed to stop implicit overlay application and lockfile poisoning. |
Suppressed comments (1)
src/args.rs:84
- Same formatting issue as the LLVM warning: the
\line continuation causes{}to be concatenated without whitespace, producing... Output may be broken.Use ...in logs. Add a space (or newline) before the continuation.
default path. Using system binaryen. Output may be broken.\
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Nothing in CI compiled for wasm32-wasmer-wasi, so the WASIX side of the build could rot silently between manual releases. Add a job that builds the module, runs the test suite under wasmer via `cargo wasix test`, and checks that neither lockfile drifted. `make wasix-test` runs it locally; the lock-swap preamble the WASIX targets share is now a `define` rather than three copies. test_run_command_success_and_failure needs `true`/`false` on PATH, which a WASIX test module can't reach — and a failed spawn there aborts the process rather than returning an error, taking the whole run with it, so gate it on non-wasm targets. 85 of 87 tests run under WASIX; the other skip is the existing cfg(unix) symlink test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rust-toolchain.toml pins 1.90, which applies to the cargo install inside the setup action too; cargo-wasix's dependency tree needs 1.91+. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1.90 was far enough behind that tools built inside the repo directory started failing their own MSRV checks (cargo-wasix needs 1.91+). fmt, tests and both feature configurations are clean on 1.97.1, and Cargo.lock is unchanged. Also adds a temporary debug step to the WASIX job, which is failing to link host build scripts with "collect2: cannot find 'ld'". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The toolchain tarball ships lib/rustlib/*/bin/gcc-ld/ld.lld without the executable bit. rustc links host build scripts with -fuse-ld=lld and -B pointing at that directory, so gcc skips the unusable shim and fails with "collect2: cannot find 'ld'". Dev boxes with lld installed system-wide don't hit it, and neither does a warm target/ where the build scripts are already cached, which is why this only showed up in CI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #72.
What was wrong
.cargo/config.tomlwas committed, so cargo auto-discovered the WASIX overlay registry on every invocation. Cargo source replacement records the replaced source id, soCargo.lockended up pinning 14X.Y.Z+wasix.Nversions that claim to come from crates.io and don't exist there.The lockfile ships inside the published
.crate, andcargo installdoesn't read the repo's cargo config — hence the reported failure. Two more consequences of the same cause:cargo vendorbreaks for downstream consumers (this is what blocks wasinix).libc/ring/rustix/cc/tokiowithout anyone intending it.For the record: the published 0.4.3 lock has 0
+wasixentries, 0.4.4 has 20.On "why do we need wasix patches in the first place?"
LLVM does run inside WASIX —
wasmer.tomldepends onwasmer/clangand setsWASIXCC_LLVM_LOCATION=/, sowasmer run wasmer/wasixccis a self-contained WASIX-native C/C++ toolchain and the driver itself has to be awasm32-wasmer-wasimodule. So the target is real.But that doesn't justify the fork set we had. 10 of the 14 forks existed only because
src/download.rspulls reqwest + rustls + ring + tokio/mio/socket2/h2/hyper — and downloading is dead code inside the Wasmer package, where clang and the sysroot come fromwasmer/clang. Onlylibc/rustix/getrandom(viatempfile/std) are unavoidable.Changes
wasix/registry.toml— the overlay config, moved out of.cargo/and passed explicitly withcargo --configby the Makefile./.cargo/is gitignored.Makefile—make wasixswapsCargo.wasix.lockin aroundcargo wasix buildand restores the crates.io lock viatrap, even on Ctrl-C. SetsCARGO_WASIX_NO_REGISTRY_CONFIG=1so cargo-wasix can't re-write.cargo/config.tomlbehind our back, and refuses to run if one reappears.make wasix-packagealso handles thewasixccenv.wasm→wasixcc.wasmnamewasmer.tomlexpects (previously a manual rename).Cargo.wasix.lock— committed. The overlay serves exactly one version of some crates (cc 1.2.27+wasix.1,reqwest 0.12.22+wasix.1) and hides upstream for forked crates, so unlocked WASIX resolution is one upstream bump away from a cryptic failure.downloadfeature (default-on) — gates the entire download stack; the WASIX build uses--no-default-features.regex,getrandom,tower,tower-layer,tower-service(zero uses insrc/), and stopped rustls' default features from compiling ~18 MB ofaws-lc-systhatdownload.rsnever calls (it installs the ring provider explicitly).lockfile-hygienejob: no tracked cargo config, no+wasixinCargo.lock,cargo metadata --locked, plus a--no-default-featurescheck. Release builds and publishes with--lockedbehind a pre-publish guard.Cargo.toml,wasmer.tomlandinstaller/public/install.sh.Verification
cargo build/test --locked— 87 tests pass; both feature configurations compile.cargo tree -i aws-lc-sys— no longer in the graph.cargo package --lockedverification build passes, and the embeddedCargo.lockhas 0+wasixentries..crateand rancargo install --lockedon it — succeeds, i.e. the exact failure incargo install --locked wasixccfails #72 is gone.cargo vendorworks again (175 crates).make wasixbuilds the module, leavesCargo.lockuntouched, and the module runs under wasmer (wasixcc 0.4.5)..cargo/config.tomland confirmedmake wasixrefuses to run.After merging
Tag
v0.4.5, thencargo yank --version 0.4.4 wasixcc— after 0.4.5 is live, not before: 0.4.4 still installs fine without--lockedand is the only 0.4.x with the recent compiler fixes.Note the lock regeneration moves several deps in one hop (
tokio 1.47→1.53,libc 0.2.183→0.2.186,clap 4.5→4.6), all semver-compatible. Worth letting the toolchain-test matrix cover macOS/arm before tagging.🤖 Generated with Claude Code