-
Notifications
You must be signed in to change notification settings - Fork 323
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
Wasm-opt fails on Rust 1.87.0+, LLVM 20+ #2601
Comments
Hi! Thanks for opening your first issue here! 😄 |
Hmm I see. |
Btw, I wonder whether if we enable these flags, will the resulting binary require more modern browser etc? |
Edit: It's from the atomics |
Hmm looks like not very modern, so maybe this is ok |
Hmm I cannot reproduce it:
|
Btw, frb's
Does passing these help? Especially, the default rustflags are:
So I wonder whether adding those to it will help |
This actually didn't happen to me before either, but abruptly started.* I'm trying to see if I can pinpoint the cause I know I did change the features to remove flutter_rust_bridge = { version = "=2.8.0", features = [
"anyhow",
"dart-opaque",
"log",
"portable-atomic",
"rust-async",
"thread-pool",
"user-utils",
] } Edit for clarity: Abruptly maybe isn't the right word. Debug builds work fine for me; this only happened to me on release I'm currently also running |
I see. Feel free to try the flags I mentioned above and see whether it works |
May I ask, what is the full arg command you'd like me to try? So far I've tried every combination of flags and args I can think of, including downgrading the compiler to your version (prob downgrading it even further would "fix it"). I still can't pinpoint the cause/solution that doesn't involve adding those wasm-opt flags :/ (well, I suppose removing all the rustflags might "work", but I also tried that in the flag, perhaps I didn't get the syntax right) (I wonder if it's an OS difference, since I'm on Windows) (I've made sure wasm-pack, wasm-bindgen, etc all is up to date too) |
I tried a new project like yours and it worked perfectly. I could not get it to fail no matter what I tried. At that point I realized it may be some config difference between new projects and my custom project structure. So I made a new empty project with my same project structure, and it reliably triggered the first time. I uploaded the failing repo for you. Though I do find it quite odd that one works but not the other. This was made by first making a cargo workspace + empty crates + empty crates/wasm dir, then using integrate with the flags
Hopefully this repo will be able to reproduce it for you On a somewhat aside note, the below command crashes. The culprit that triggers it is using a hyphen in the project name (
|
etc i.e. try to add those required flags into the wasm-pack-rustflags or things like that |
It's telling me it doesn't recognize them (I tried various combinations, from a single flag, to many, commas, no commas, etc, all leading to it not working). Seems rustc doesn't like it
(I also tried |
Well, in #2601 (comment) I mentioned it is originally |
Thanks for your suggestion. I get the same log output as usual with this command 😧 (the usual you need to
(Thanks for taking the time to go through this by the way 😊 . I appreciate all the work you've put into this library) |
You are welcome! Well I mean tweaking the flags... |
Btw how do you achieve this, and does that already fix you scenario? |
I achieved it by copying it to my repo, disabling and manually calling it in my command runner (just). It does fix it, but it's not a very good solution (then again, there may not be any real better way to solve it, short of disabling the wasm features through the compiler flags. I suppose restructuring the project would fix it too, though I much rather like my current structure) [package.metadata.wasm-pack.profile.release]
wasm-opt = false Edit: Removing my release profile in the workspace fixes it, specifically [profile.release]
lto = true
codegen-units = 1
strip = true Since that seems to be the issue, maybe it's a rust bug, I'll report it to them. |
Describe the bug
An update to Rust with LLVM 20 requires new wasm features in the resulting binary. The new wasm features caused downstream breakage for a lot of people.
Affected: Rust 1.87.0+, LLVM 20+
Log file of failing build:
out.txt
Adding these flags to
wasm-opt
fixes the compilation--enable-bulk-memory --enable-threads --enable-nontrapping-float-to-int
Note: I am unsure how exactly the compilation takes place. Perhaps who's at fault here is wasm-pack? In either case, this bridge plugin is still affected though
Please see
rust-lang/rust#137315
rust-lang/rust#137322
https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-unknown-unknown.html#enabled-webassembly-features
Steps to reproduce
Logs
n/a (log is in first post)
Expected behavior
Compiles properly
Generated binding code
OS
Wasm
Version of
flutter_rust_bridge_codegen
2.8.0
Flutter info
Version of
clang++
n/a
Additional context
No response
The text was updated successfully, but these errors were encountered: