-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Win10: Trying to link Bevy dynamically results in the error STATUS_ENTRYPOINT_NOT_FOUND
#1126
Comments
Hmm yeah a number of people are reporting issues with dynamic linking on windows. Currently I'm working from my linux/mac laptop, so I won't be able to investigate Windows-related issues until I get back to my desktop in early-January. I'm hoping a motivated Windows user will pick this up before then 😄 |
Building without fast-build configuration gives link error 1189 (too many objects). It compiles with fast-build, but the generated DLL has exact 65536 functions exported. It seems the DLL being sliently truncated. |
I have a feeling that glsl-to-spirv is the culprit. Basically every link issue we've had in the past can be traced back to it. Maybe try removing that dep and commenting out relevant code until it compiles? It wouldn't work but if we don't get the link error, then we have our culprit. |
I’ve encountered all of these problems and found a solution, and I think we should create a README file for anyone who has a problem to solve. ├── .cargo
│ └── config.toml
├── .gitignore
├── Cargo.lock
├── Cargo.toml
└── src
└── main.rs 2.Modify the [target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=off"] # Here is the key to solving this problem 3.(optional) next modify your [dependencies]
bevy = { version = "0.4", features = ["dynamic"] } 4.Run your project happily: cargo run If you did not choose 3: cargo run --features bevy/dynamic This method also applies to #1110 I need your feedback. |
@Cupnfish I think you're right. There are over 90k monomorphized functions from rust core in .so file built on linux. Disabling share-generics makes total exported functions down to 19k on windows. |
For me, using link.exe instead of rust-lld.exe on Windows fixed the problem. |
@Cupnfish |
I can verify that |
Looks like on Windows dynamic linking works but only when deactivating Generic sharing (bevyengine/bevy#1126). This commit corrects the text.
@Cupnfish Caused by: |
@Divakar-2508: In order to enable dynamic linking, you need to install and use nightly Rust. |
@alice-i-cecile aight, I'll check it and update! :) |
# Objective - #13136 changed the default value of `-Zshare-generics=n` to `-Zshare-generics=y` on Windows - New users are encouraged to use dynamic builds and LLD when setting up Bevy - New users are also encouraged to check out `fast_config.toml` - #1126 means that running dynamic builds, using LLD and sharing generics on Windows results in a cryptic error message As a result, a new Windows user following all recommendations for better compiles is actually not able to compile Bevy at all. ## Solution - Set `-Zshare-generics=n` on Windows with a comment saying this is for dynamic linking ## Testing I verified that #1126 is still in place on the current nightly (1.80) ## Additional Info Maybe the website should mention this as well? The relevant snippet there looks like this: ```toml # /path/to/project/.cargo/config.toml [target.x86_64-unknown-linux-gnu] rustflags = [ # (Nightly) Make the current crate share its generic instantiations "-Zshare-generics=y", ] ``` so it kinda implies it's only for Linux? Which is not quite true, this setting works on macOS as well AFAIK
# Objective - bevyengine#13136 changed the default value of `-Zshare-generics=n` to `-Zshare-generics=y` on Windows - New users are encouraged to use dynamic builds and LLD when setting up Bevy - New users are also encouraged to check out `fast_config.toml` - bevyengine#1126 means that running dynamic builds, using LLD and sharing generics on Windows results in a cryptic error message As a result, a new Windows user following all recommendations for better compiles is actually not able to compile Bevy at all. ## Solution - Set `-Zshare-generics=n` on Windows with a comment saying this is for dynamic linking ## Testing I verified that bevyengine#1126 is still in place on the current nightly (1.80) ## Additional Info Maybe the website should mention this as well? The relevant snippet there looks like this: ```toml # /path/to/project/.cargo/config.toml [target.x86_64-unknown-linux-gnu] rustflags = [ # (Nightly) Make the current crate share its generic instantiations "-Zshare-generics=y", ] ``` so it kinda implies it's only for Linux? Which is not quite true, this setting works on macOS as well AFAIK
# Objective - bevyengine#13136 changed the default value of `-Zshare-generics=n` to `-Zshare-generics=y` on Windows - New users are encouraged to use dynamic builds and LLD when setting up Bevy - New users are also encouraged to check out `fast_config.toml` - bevyengine#1126 means that running dynamic builds, using LLD and sharing generics on Windows results in a cryptic error message As a result, a new Windows user following all recommendations for better compiles is actually not able to compile Bevy at all. ## Solution - Set `-Zshare-generics=n` on Windows with a comment saying this is for dynamic linking ## Testing I verified that bevyengine#1126 is still in place on the current nightly (1.80) ## Additional Info Maybe the website should mention this as well? The relevant snippet there looks like this: ```toml # /path/to/project/.cargo/config.toml [target.x86_64-unknown-linux-gnu] rustflags = [ # (Nightly) Make the current crate share its generic instantiations "-Zshare-generics=y", ] ``` so it kinda implies it's only for Linux? Which is not quite true, this setting works on macOS as well AFAIK
Bevy version
0.4
Operating system & version
Windows 10, version: 1909, OS build: 18363.1256, 64-bit
What you did
I ran the binary with
cargo run --features bevy/dynamic
as instructed by the Bevy book. I believe I had the correct software and the given config.toml file at the folder .cargoWhat you expected to happen
The game running regularly and opening my screen, just like when not using the features flag.
What actually happened
After the cargo started running the application, it exited with the error message:
error: process didn't exit successfully: `target\debug\<crate>.exe` (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)
Additional information
The current code is basically a very slightly modified version of the 3d scene example from the repo, with only main.rs in the src folder and no other dependencies besides Bevy 0.4.
I tried removing the
"-Zshare-generics=y"
flag from.cargo/config.toml
, and also running it with stable. Both variations had the same result and message.When I had only the cargo's autogenerated helloworld in my main.rs, the binary functioned normally with and without the flag, which is why I believe that my setup should be correct.
The text was updated successfully, but these errors were encountered: