:wave: @Alex Crichton I'm interested in making a code contribution to cargo-wasi to address wasm-opt not working out-of-the-box on Apple Silicon. We've had a few devs on Apple silicon express some frustration with the current workflow of downloading wasm-opt separately and needing to use the WASM_OPT environment variable. I can see a couple approaches that could address the issue:
wasm-opt binary.wasm-opt is downloaded such that the missing dylib is available on the path that wasm-opt is expecting it on, download a newer version of wasm-opt, and then adjust the logic that checks if wasm-opt can be downloaded to include Apple silicon. This would be split into separate PRs.I'd prefer (1) but am open to (2). I'm also open to other suggestions!
Hello! Personally I'd prefer to stick to using the CLI if possible, it's pretty hairy linking with C++ code and distributing that so stick to precompiled artifacts from elsewhere is my preerred route.
To clarify for approach (1), we'd be using the binaryen crate which handles the linking rather than implementing the linking in cargo-wasi itself. That crate has the same license as cargo-wasi. We've been using it in Javy to run wasm-opt optimizations and have not noticed any pain or hairiness around linking or distribution. You can see how we interact with it in the code section I linked.
I've historically used the binaryen crate actually but I would still prefer to use precompiled binaries from binaryen itself. Shipping C++ is nontrivial all the complexity still has to go somewhere even if it's all encapsulated in a different crate (and I'm not sure if that crate encapsulates everything)
Alright, I'll get started on approach (2). Thank you for providing your feedback on the approaches :smile:! Thinking more about this, I'll probably start by opening a dedicated PR to have cargo-wasi download a newer version of wasm-opt that includes a release with Apple silicon support, and then do the other work for approach (2) separately, as I'm working on a computer with a Apple silicon processor.
sounds good!
Jeff Charles has marked this topic as resolved.
Last updated: Dec 06 2025 at 05:03 UTC