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

Fast compile generics setting causes build fail on windows #5505

Closed
Parallel-Paradox opened this issue Jul 31, 2022 · 9 comments
Closed

Fast compile generics setting causes build fail on windows #5505

Parallel-Paradox opened this issue Jul 31, 2022 · 9 comments
Labels
P-Compile-Failure A failure to compile Bevy apps S-User-Error This issue was caused by a mistake in the user's approach

Comments

@Parallel-Paradox
Copy link

Bevy version

The main version with commit code: 83a9e16

Relevant system information

Windows, rust nightly version installed.

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default) (override)

What you did

Do exactly as Enable fast compile

What went wrong

I got error message when cargo run --features bevy/dynamic:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Zshare-generics=n --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
  --- stderr
  error: the option `Z` is only accepted on the nightly compiler

Additional information

After I disable the config in ${workspaceFolder}/.cargo/config.toml:

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

The compile process runs properly. I've checked the rust-lld.exe is in .rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\bin\rust-lld.exe, so it might caused by rustflags.

@Parallel-Paradox Parallel-Paradox added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 31, 2022
@bjorn3
Copy link
Contributor

bjorn3 commented Jul 31, 2022

The full fast compile configuration only works with nightly rustc.

@Parallel-Paradox
Copy link
Author

The full fast compile configuration only works with nightly rustc.

I see... I've checked the version of rustc, it turns out that, after I do rustup default nightly, the rustc version is still rustc 1.62.1 (e092d0b6b 2022-07-16), which is suppose to be rustc 1.64.0-nightly... Is there a way to change the version manually?

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 31, 2022

What does rustup show output?

@Parallel-Paradox
Copy link
Author

What does rustup show output?

I've tried both in default and overrive

$ rustup toolchain list
stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc (override)

$ rustup toolchain list 
stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default) (override)

But the rustc version dosen't change.

$ rustc --version
rustc 1.62.1 (e092d0b6b 2022-07-16)

By the way I set custom env var CARGO_HOME and RUST_HOME to download rust in D:/ .

Maybe I should re-install rust..

@Parallel-Paradox
Copy link
Author

Default host: x86_64-pc-windows-msvc
rustup home:  D:\rust\.rustup

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)

active toolchain
----------------

nightly-x86_64-pc-windows-msvc (overridden by 'D:\code_project\bevy_playground\rust-toolchain.toml')
rustc 1.64.0-nightly (0f4bcadb4 2022-07-30)

This is rustup show

@Parallel-Paradox
Copy link
Author

I checked the path of rustc by running where rustc in CMD.

D:\rust\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\rustc.exe
D:\rust\.cargo\bin\rustc.exe

I realize that it might because that shell can't recognize the path of rustc because I checked the existence of rustc.exe in the folder of nightly version.

@Parallel-Paradox
Copy link
Author

So I solved this problem in a cheat way: I changed the folder's name from nightly-x86_64-pc-windows-msvc into stable-x86_64-pc-windows-msvc, and the original one is changed into stable-x86_64-pc-windows-msvc-backup.

Also I changed the rust-toolchain.toml's channel from nightly into stable.

Now the generics feature can work properly, but this methods may have some potential side-effect so I'm still in search of a better way to solve this issue.

@mockersf
Copy link
Member

mockersf commented Jul 31, 2022

with an override or a default, cargo is handling rust nightly selection for you, it's not directly calling the rustc binary
you can also run cargo +nightly run to select nightly only for a command

@Parallel-Paradox
Copy link
Author

Simply uninstall stable version also solve this issue. But this #2921 still occurs since I'm using Win11... So I guess I'm just going to clost this generics feature.

@Nilirad Nilirad added S-User-Error This issue was caused by a mistake in the user's approach A-Meta About the project itself P-Compile-Failure A failure to compile Bevy apps and removed S-Needs-Triage This issue needs to be labelled C-Bug An unexpected or incorrect behavior A-Meta About the project itself labels Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-Compile-Failure A failure to compile Bevy apps S-User-Error This issue was caused by a mistake in the user's approach
Projects
None yet
Development

No branches or pull requests

4 participants