-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Bevy does not start on WASM because of the rand crates. #1376
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
Comments
👋 welcome! The one difference between rand in bevy and in seed is a feature: As feature are additive, enabling it for rand through seed also enables it in bevy dependencies. Could you try to not import seed, but import rand with the same feature? It would not be a real fix, but would help to identify the cause.
|
Thanks for feedback. I tried the rand trick but it didn't work. I run a diff between the output of |
Swapping out the seed dependency for |
Here's a more complete stack trace in case it's useful
|
@rparrett Are you sure about the |
No, I may have goofed, or maybe there's something intermittent going on. I can't seem to even reproduce the panic anymore. By the way, did you mean to link to your other |
I am so sorry, I indeed linked the wrong repository. I now edited the first message to avoid confusion. Edit: The linked repo was the one where I found the issue but contains a bit more code than necessary that's why I set up another one for this issue. The "good" news is that the problem is the same and for example the call stack you printed earlier is also correct. About reproducing it, I disabled caching thanks to the Chrome dev tools and sometimes to make sure I just delete the static directory in |
I just went through the procedure again, adding cargo clean into the mix and being extra careful. Adding In bevy 0.4, bevy_scene, bevy_reflect, and bevy_utils otherwise specify From uuid 0.8.2's changelog:
So I think there could be something to this, but I haven't quite connected all the dots. |
@rparrett Thanks for giving this another go. I will do another round later today because I want to make sure we can reproduce it and pin down to a particular crate. Regarding the (maybe) intermittent nature of the bug: If this the case (I will triple check this), doesn't it look a bug in cargo and/or rustc? Because, to me it means that the same input files (cargo.toml and some rust source code) would behave differently at runtime depending on earlier commands which isn't something I want. |
So toggling on and off and building with
I was able to confirm that indeed this make the program run normally or crash depending if uuid in version 0.8.1 is used. Thanks for the help @rparrett. At this point we have at least pinpointed the problem and found a workaround. |
This is really unfortunate, but I don't think there's anything we can do at this point. Going to close as unactionable :( This is another argument in favor of #3992. |
Reopening... We should just remove |
Closed, as #3992 is merged. If you have encountered a new related problem, please open a new issue :) |
Bevy version
"0.4.0"
Operating system & version
Windows 10 and building for WASM.
What you did
I created a basic project to play with Seed (a Rust wasm framework) and Bevy to see how the 2 could interoperate. As I ran into other issues with Bevy I tried to setup a project for reproducing the bug. When I removed the Seed dependency another bug showed up (this one).
What you expected to happen
In this repository I set up the project is working fine as it is. But it contains Seed as a dependency that isn't needed. I expected to run just the same when removing the Seed dependency. Instead I got a crash with this error:
To sum up, if you use the repo linked earlier, it will run fine as it is. When you edit the
Cargo.toml
to remove the Seed dependency it still build fine but crash at runtime while it shouldn'tAdditional information
The call stack and some messages here and here on the Bevy discord seems to indicate that is a buggy version of the
rand
crate (or one of its dependencies). This would explain why it works with Seed. Since it uses rand it might trigger another version to be used which doesn't have this bug.What could improve the situation is to pin exact version of the random crates that are known to work with WASM
PS: Thanks to Alice and DJMcNab on the Discord server for helping newcomers.
The text was updated successfully, but these errors were encountered: