Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trunk cannot build --release with wasm that uses threads / bulk memory #866

Open
BGR360 opened this issue Sep 7, 2024 · 1 comment
Open

Comments

@BGR360
Copy link
Contributor

BGR360 commented Sep 7, 2024

It fails at the wasm-opt stage:

[wasm-validator error in module] unexpected false: shared memory requires threads [--enable-threads], on 
memory
[wasm-validator error in module] unexpected false: nonzero segment flags require bulk memory [--enable-bulk-memory], on 
[wasm-validator error in module] unexpected false: nonzero segment flags require bulk memory [--enable-bulk-memory], on 
[wasm-validator error in module] unexpected false: nonzero segment flags require bulk memory [--enable-bulk-memory], on 
Fatal: error validating input
2024-09-07T05:47:45.715687Z ERROR ❌ error
error from build pipeline

Caused by:
    0: HTML build pipeline failed (1 errors), showing first
    1: error from asset pipeline
    2: running wasm-opt
    3: wasm-opt call to executable '/home/runner/.cache/trunk/wasm-opt-version_116/bin/wasm-opt' with args: '["--output=/home/runner/work/dactyl/dactyl/target/wasm-opt/release/dactyl_bg.wasm", "-O", "/home/runner/work/dactyl/dactyl/dist/.stage/dactyl-50e150da88065d87_bg.wasm"]' returned a bad status: exit status: 1

I propose adding another data-... option to rust assets, similar to these ones:

let reference_types = attrs.contains_key("data-reference-types");
let weak_refs = attrs.contains_key("data-weak-refs");

@BGR360
Copy link
Contributor Author

BGR360 commented Sep 7, 2024

Similar to #854 (comment), it would have been really useful for me if Trunk offered an option to pass arbitrary extra flags to wasm-opt.

@BGR360 BGR360 changed the title Trunk cannot build with wasm that uses threads / bulk memory Trunk cannot build --release with wasm that uses threads / bulk memory Sep 7, 2024
BGR360 added a commit to BGR360/trunk that referenced this issue Sep 8, 2024
This enables the `threads`, `bulk-memory`, and `mutable-globals`
options in `wasm-opt`, which if absent can result in `wasm-opt`
failing to optimize wasm modules compiled with threading features.

Fixes trunk-rs#866.
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 a pull request may close this issue.

1 participant