Repository navigation
Open
Labels
Milestone
Description
Goal
Bootstrap from a portable artifact checked into the repo, not from a seed binary per host fetched from a release. Today every host needs its own seed (darwin-aarch64, linux-x86_64, linux-aarch64, windows-x86_64), each cut on its own machine, and the seed operations fail in ways that keep showing up:
- seed: a stale seed links out/bootstrap-lib built from newer rt sources, so :seed cannot fetch the pinned seed #2360: a stale seed cannot fetch the pinned one.
- A battery driven by the wrong seed goes red for reasons unrelated to the change under test.
- D30 implementation: retire the internal runtime ABI — runtime compiles in-unit; rt objects only a keyed cache; boundaries speak C #761's class: runtime objects from two compiler generations get linked together.
What Zig does (ziglang/zig, verified in stage1/ and bootstrap.c)
| File | Size | Role |
|---|---|---|
stage1/zig1.wasm |
3.2 MB | the compiler built for wasm32-wasi, checked in |
stage1/wasm2c.c |
122 KB | translates a wasm module to C; a translator, not an interpreter (Zig dropped interpretation as too slow) |
stage1/wasi.c |
40 KB | the WASI imports, as C |
bootstrap.c |
builds wasm2c with the host cc, translates zig1.wasm to C, builds that, and uses the result to build the real compiler |
Bootstrap needs only a C compiler, which every host has. zig1.wasm is updated rarely, by hand, when the compiler needs a newer language feature.
Decision (Eric, 2026-10-12)
with migrate stage1/wasm2c.c (and wasi.c) to With.
Open question: what builds the translator
A With wasm2c is With source, so building it needs a With compiler. Its output is C, so the bootstrap also needs a host C compiler, and today the tree has no C (only .s). Possible answers, for a ruling:
- Frozen per-host runner. Keep a per-host binary, but only of the translator plus WASI. It is small and changes rarely, while the compiler moves as one
with1.wasmfor every host. Seeds stop churning with every compiler change, but they still exist. - Self-applied translator. Ship the translator itself as wasm too, translated once to C (Zig's shape) and kept as a generated, checked-in artifact. That needs a ruling against "not a line of non-With code", even for generated output.
- Native code instead of C. Have the With wasm2c emit platform assembly (
.sis allowed), assembled by the host assembler. Each host target needs its own backend in the translator.
Prerequisites to verify
- The compiler builds for wasm32 with a WASI-shaped runtime. Today wasm32 is a program target (
build.w,:cross-rt-wasm,wasm32-unknown-unknown), not yet a target the compiler itself builds for. with migratehandleswasm2c.cwithout stubs (No Silent Fallbacks): any function it can't translate is a loud failure to fix in the migrator.- How fast the translated compiler is: Zig accepts a slow zig1 because it builds only zig2.
Activity
ehartford commentedon Oct 12, 2026
Eric (2026-10-12): "we can checkin the binary like they do". As Zig checks in
stage1/zig1.wasm, the bootstrap artifact is committed to the repo, not fetched from a release.ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced: not started. The tree has no checked-in.wasmbootstrap artifact and nowasm2cpath inbuild.w,build/orsrc/. Eric (2026-10-12, comment above): "we can checkin the binary like they do".post-release: a bootstrap campaign.