fix(oci): strip wasm debug symbols so wasm-opt stops aborting #54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/wasm-opt-strip-debug-LINKS-20"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes LINKS-20:
dx buildsilently shipped UNOPTIMIZED frontend wasm because Binaryen wasm-opt crashed.Root cause (verified in the toolchain)
dx defaults
--debug-symbolstotrue, embedding DWARF debug info in the release wasm. Binaryen wasm-opt aborts parsing that DWARF with SIGABRT:compile unit size was incorrect (this may be an unsupported version of DWARF). I reproduced the abort against the real wasm-bindgen output and confirmed it fires on every Binaryen 127, 128, 129, and 130 (dx 0.7.7 and 0.7.9 both download version_127). dx catches the wasm-opt failure, exits 0, and keeps the unoptimized 3.4MB bundle. So upgrading Binaryen does NOT help; the trigger is the DWARF, not the wasm-opt version.Fix
Build with
dx build --release --debug-symbols falseso the wasm carries no DWARF, wasm-opt runs to completion, and the client bundle drops from 3.4MB to 1.8MB. Production needs no DWARF; localdx servekeeps the default. Verified end to end: with the flag,dx buildexits 0 with no wasm-opt failure and emits the 1.8MB optimized wasm.Also wraps the build in a guard (AC4): dx exits 0 even when wasm-opt fails, so the step greps dx output for
wasm-opt failedand fails the build rather than silently shipping unoptimized WASM.pipefailkeeps a genuine dx build failure fatal despite thetee. Guard logic tested for success, swallowed-wasm-opt-failure, and real-build-failure cases.CI note (not introduced by this PR)
mainalready referencesghcr.io/niceguyit/rust-builder-glibc:v1.0.2-rust1.94-trixie(merged in #53) but that tag is not yet published to GHCR (404), so OCI builds offmaincurrently fail at theFROMresolve. This PR inherits thatFROMand will stay red until the companionniceguyit/oci-imageschange publishes v1.0.2. Once v1.0.2 is live, this builds green. The wasm-opt fix itself was validated against v1.0.1 (dx 0.7.7) and holds on v1.0.2 (same Binaryen 127, same--debug-symbolsknob).Acceptance criteria
compile unit size was incorrect).--debug-symbols false(no toolchain bump needed; no Binaryen version parses the DWARF).dx build --releasecompletes wasm-opt without SIGABRT; bundle 3.4MB -> 1.8MB.Refs LINKS-20.
dx defaults to embedding DWARF debug info in the release wasm (--debug-symbols defaults to true). Binaryen wasm-opt (every version 127-130, and version_127 is what dx 0.7.x downloads) aborts with SIGABRT parsing it ("compile unit size was incorrect (this may be an unsupported version of DWARF)"). dx swallows the failure, exits 0, and silently ships the UNOPTIMIZED 3.4MB wasm (LINKS-20, observed in OCI build run #136). Building with --debug-symbols false lets wasm-opt complete and drops the client bundle to 1.8MB. Production needs no DWARF; dev `dx serve` keeps the default and is unaffected. Add a guard around the build: dx exits 0 even when wasm-opt fails, so the step greps dx output and fails the build rather than silently shipping unoptimized WASM. pipefail keeps a genuine dx build failure fatal despite the tee. Root cause verified directly in the rust-builder-glibc toolchain: no Binaryen 127-130 parses the rustc/wasm-bindgen DWARF; --strip-debug (which --debug-symbols false triggers) is the only thing that avoids the abort. #LINKS-20 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>