Skip to content

cli: mirror Cargo's implicit strip default when manually stripping binaries (fixes wasm-opt SIGABRT) - #5736

Open
nicoburns wants to merge 2 commits into
mainfrom
devin/1785888887-strip-implicit-default
Open

cli: mirror Cargo's implicit strip default when manually stripping binaries (fixes wasm-opt SIGABRT)#5736
nicoburns wants to merge 2 commits into
mainfrom
devin/1785888887-strip-implicit-default

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Summary

Fixes #5119 (wasm-opt failed with status code signal: 6 (SIGABRT) / compile unit size was incorrect on dx build --web --release).

Root cause: since #4966 (0.7.2), dx always builds with --config profile.<x>.strip=false (to keep manganis symbols alive) and relies on post_process_executable/get_strip_setting to strip manually afterwards. But get_strip_setting only honored an explicit strip key in Cargo.toml and returned StripSetting::None otherwise — it didn't replicate Cargo's implicit default (since Rust 1.77, Cargo strips debuginfo when the profile's debuginfo is disabled, as release is by default). So ~1.3MB of DWARF from the precompiled std stayed in release wasm. wasm-bindgen (--keep-debug, on by default via --debug-symbols) then rewrites that DWARF, and binaryen's wasm-opt aborts trying to re-emit it (DWARFEmitter.cpp:201). In 0.7.1 the linker stripped the debuginfo (Cargo's default), which is why the same flags worked there.

Change in get_strip_setting, after resolving the profile's inherits chain:

explicit strip in profile chain  -> use it (as before)
otherwise                        -> resolve `debug` in profile chain
                                    (default: release=off, dev=full)
   debug off  -> StripSetting::Debuginfo   // Cargo's implicit default
   debug on   -> StripSetting::None

Verification

  • Minimal repro (wasm-bindgen 0.2.126 + binaryen): strip=false build → wasm-bindgen --keep-debugwasm-opt --debuginfo reproduces the exact SIGABRT; the same wasm without the wasm-bindgen rewrite, or with Cargo's default strip, passes.
  • Unpatched dx from main reproduces the failure on a hello-world web app in --release; with this patch the build succeeds and the output wasm contains no .debug_* sections (1.6MB → 471KB).
  • wasm-split builds are unaffected (post_process_executable still returns early), as are dev builds (debug resolves to full → no strip).

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/819f3522f488427cb8df5f6e12b5af56
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 5, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

Failed to build was app. wasm-opt failed with status code 6

1 participant