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

Building the tutorial code with bevy/dynamic on Windows 10 raises error #2006

Open
mattdeboard opened this issue Apr 25, 2021 · 18 comments
Open
Labels
A-Build-System Related to build systems or continuous integration C-Bug An unexpected or incorrect behavior C-Startup A crash that occurs when first attempting to run a Bevy app O-Windows Specific to the Windows desktop operating system P-Crash A sudden unexpected crash

Comments

@mattdeboard
Copy link

mattdeboard commented Apr 25, 2021

Bevy version

0.5

Operating system & version

Windows 10 Version Dev (OS Build 21364.1000)

What you did

cargo run --features bevy/dynamic running against the code that is set up as directed on this page of the book.

What you expected to happen

The code would have run exactly the same as if I'd left off --features bevy/dynamic, but compile slower.

What actually happened

The code compiled about as fast but it raises this error:

error: process didn't exit successfully: `target\debug\shodokan.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

Additional information

The repo in question.

Here is my .cargo/config.toml file (Note: "-Zshare-generics=off"; I did that because I was having same issue from #1110. Setting generics=off seemed to resolve my LNK1189 problem for the time being.):

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]

# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=off"]

Here is my Cargo.toml:

[package]
name = "shodokan"
version = "0.1.0"
authors = ["Matt DeBoard <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# bevy = { version = "0.5", features = ["dynamic"] }
bevy = "0.5"
@mattdeboard mattdeboard added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Apr 25, 2021
@Moxinilian Moxinilian added P-Crash A sudden unexpected crash O-Windows Specific to the Windows desktop operating system A-Build-System Related to build systems or continuous integration and removed S-Needs-Triage This issue needs to be labelled labels Apr 25, 2021
@b-ncMN
Copy link

b-ncMN commented Jul 23, 2021

I am having the same problem here

PS C:\Users\infrandomness\Documents\Dev\Rust\Kizzle> cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `D:\Rust\debug\kizzle.exe`
error: process didn't exit successfully: `D:\Rust\debug\kizzle.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

I use windows 11 and rustc 1.55.0-nightly (027187094 2021-07-22), the executable is linked with https://github.com/rust-embedded/cargo-binutils' rust-lld

@thargy
Copy link

thargy commented Aug 24, 2021

Similar, except:

error: could not compile `fluent-templates` v.0.6.1

Caused by:
  process didn't exit successfully: `rustc --crate-name fluent_templates --edition=2018 'C:\Users\tharg\.cargo\registry\src\github.com-1ecc6299db9ec823\fluent-templates-0.6.1\src\lib.rs' --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="fluent-template-macros"' --cfg 'feature="macros"' -C metadata=4356cd308ddd0ba0 -C extra-filename=-4356cd308ddd0ba0 --out-dir 'C:\Source\Apocraphy\target\debug\deps' -C linker=rust-lld.exe -L 'dependency=C:\Source\Apocraphy\target\debug\deps' --extern 'arc_swap=C:\Source\Apocraphy\target\debug\deps\libarc_swap-b23ff8ffee273de3.rmeta' --extern 'fluent=C:\Source\Apocraphy\target\debug\deps\libfluent-d105803f1cd3257b.rmeta' --extern 'fluent_bundle=C:\Source\Apocraphy\target\debug\deps\libfluent_bundle-1560bd7439b31558.rmeta' --extern 'fluent_langneg=C:\Source\Apocraphy\target\debug\deps\libfluent_langneg-a6ee212aa3ac8830.rmeta' --extern 'fluent_syntax=C:\Source\Apocraphy\target\debug\deps\libfluent_syntax-6b3f054aa674929d.rmeta' --extern 'fluent_template_macros=C:\Source\Apocraphy\target\debug\deps\fluent_template_macros-4a35585cd7523c8b.dll' --extern 'flume=C:\Source\Apocraphy\target\debug\deps\libflume-112cb79d3f152edf.rmeta' --extern 'heck=C:\Source\Apocraphy\target\debug\deps\libheck-1b1cef92907c2381.rmeta' --extern 'ignore=C:\Source\Apocraphy\target\debug\deps\libignore-b132601bc5228a36.rmeta' --extern 'lazy_static=C:\Source\Apocraphy\target\debug\deps\liblazy_static-915917b7703ad76d.rmeta' --extern 'log=C:\Source\Apocraphy\target\debug\deps\liblog-f87c22c6a28f2b86.rmeta' --extern 'once_cell=C:\Source\Apocraphy\target\debug\deps\libonce_cell-4288902be234134d.rmeta' --extern 'serde_json=C:\Source\Apocraphy\target\debug\deps\libserde_json-f3db35c2c1aeb8b3.rmeta' --extern 'snafu=C:\Source\Apocraphy\target\debug\deps\libsnafu-c719cf7887e33e95.rmeta' --extern 'unic_langid=C:\Source\Apocraphy\target\debug\deps\libunic_langid-f87cd1757c4b5912.rmeta' --cap-lints allow -Zshare-generics=y` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

for:

bevy = { git = "https://github.com/bevyengine/bevy", rev = "958f8b124a1d0aa89f6ed70dd8e4c6e09ec654a1", features = ["dynamic"] }

also without dynamic feature:

bevy = { git = "https://github.com/bevyengine/bevy", rev = "958f8b124a1d0aa89f6ed70dd8e4c6e09ec654a1" }

@thargy
Copy link

thargy commented Aug 24, 2021

Commenting out the following in .cargo/config.toml

[target.x86_64-pc-windows-msvc]
#linker = "rust-lld.exe"
#rustflags = ["-Zshare-generics=y"]

Goes further, but linking fails:

error: linking with `link.exe` failed: exit code: 1189
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.30.30423\\bin\\HostX64\\x64\\link.exe" "/DEF:C:\\Users\\tharg\\AppData\\Local\\Temp\\rustczMZKMC\\lib.def" <TRUNCATED>
  = note: LINK : fatal error LNK1189: library limit of 65535 objects exceeded

Uncommenting just the linker = "rust-lld.exe" causes fluent-templats to fail again. 😢
Uncommenting just the rustflags = ["-Zshare-generics=y"] get us back to the linking error. 😢

So we can't build fluent-templates with rust-lld.exe and we can't link without it 🤷

@thargy
Copy link

thargy commented Aug 24, 2021

OK, building without dynamic feature and without rust-lld.exe at least succeeds.

i.e.

# Cargo.toml
bevy = { git = "https://github.com/bevyengine/bevy", rev = "958f8b124a1d0aa89f6ed70dd8e4c6e09ec654a1" }

# .cargo/config.toml
[target.x86_64-pc-windows-msvc]
#linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=y"]

@thargy
Copy link

thargy commented Aug 25, 2021

Also, although I can now build v.5.0 (just couldn't get past build issues with nightly), I cannot see debug variable in VSCode any more 😢

@steele123
Copy link

steele123 commented Sep 19, 2021

Just wanted to point out that this issue is specific to Windows 11 and dev builds of Windows

@thargy
Copy link

thargy commented Sep 19, 2021

Can confirm was on Win11.

@SecretPocketCat
Copy link
Contributor

Yep, on Win 11 (day1 release - 21H2) trying to run with dynamic (-Zshare-generics=n) ends the process with

error: process didn't exit successfully: `target\debug\app.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

@SecretPocketCat
Copy link
Contributor

Added this issue #2921 for Win11

@thargy I believe the share generics flag should be set to n on Win
rustflags = ["-Zshare-generics=n"]

@thargy
Copy link

thargy commented Oct 6, 2021

@SecretPocketCat thanks, I gave up on Bevy for now.

@alice-i-cecile alice-i-cecile added C-Startup A crash that occurs when first attempting to run a Bevy app P-Compile-Failure A failure to compile Bevy apps and removed P-Compile-Failure A failure to compile Bevy apps labels Dec 21, 2021
@Ancientkingg
Copy link

Yes, I can also confirm that on Windows 11 I am getting the exact same error.

@b-ncMN
Copy link

b-ncMN commented Mar 4, 2022

It would probably help to use LLD for linking and avoid relying on Window's Linker entirely.

@Ancientkingg
Copy link

It would probably help to use LLD for linking and avoid relying on Window's Linker entirely.

I am actually using the LLD linker for this.

I have installed the LLD Linker using this:

cargo install -f cargo-binutils
rustup component add llvm-tools-preview

and I have this in my .cargo/config.toml:

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=n"]

@BatmiBoom
Copy link

Hey guys! any solutions to this problem?

@makexiao113
Copy link

hello, any solutions to this problem? win11 same error

@makexiao113
Copy link

hello, any solutions to this problem? win11 same error
use

bevy = "0.7"

instead of

bevy = { version = "0.7", features = [ "dynamic"] }

can solve this problem

@makexiao113
Copy link

Hey guys! any solutions to this problem?

use

bevy = "0.7"
instead of

bevy = { version = "0.7", features = [ "dynamic"] }
can solve this problem

@Fidius-jko
Copy link

i use win 10 and wsl and i'm fine
even if I have bevy = { version = "0.7", features = [ "dynamic"] }
, but if I run the program without wsl - the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Build-System Related to build systems or continuous integration C-Bug An unexpected or incorrect behavior C-Startup A crash that occurs when first attempting to run a Bevy app O-Windows Specific to the Windows desktop operating system P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests