From 88450f0cd149ea5b25e71e3ab0dd6059ddca9c29 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 10 Jul 2026 09:36:43 +0300 Subject: [PATCH] fix(web): keep wasm target_features section so wasm-opt accepts bulk-memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The release profile's strip = true (added in #324) strips the wasm target_features custom section. Without it, wasm-opt can't tell that bulk-memory is enabled and rejects the module's memory.fill/copy ops ("operations require bulk memory"), failing the release web build — the newer Rust toolchain now emits those ops by default. Override strip only for the wasm target with -Cstrip=none, so native release binaries stay stripped while the wasm keeps its feature section. Co-Authored-By: Claude Opus 4.8 --- .cargo/config.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 7ec6f88e6..15fd75d2a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,5 +2,11 @@ # browser backend on wasm32-unknown-unknown, alongside its `wasm_js` feature # (enabled in Cargo.toml for the wasm target). Without it the web build fails # with "wasm32-unknown-unknown targets are not supported by default". +# +# `-Cstrip=none` overrides the release profile's `strip = true` for the wasm +# target only: stripping removes the `target_features` custom section, so +# `wasm-opt` can no longer see that `bulk-memory` is enabled and rejects the +# module's memory.fill/copy ops ("require bulk memory"). Native release binaries +# stay stripped; only the wasm keeps its feature section. [target.wasm32-unknown-unknown] -rustflags = ['--cfg', 'getrandom_backend="wasm_js"'] +rustflags = ['--cfg', 'getrandom_backend="wasm_js"', '-Cstrip=none']