-
Notifications
You must be signed in to change notification settings - Fork 100
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
Using in Windows #1509
Comments
Cranelift doesn't support enough optimizations to make it useful in release mode.
It isn't distibuted with rustup on Windows yet. You can download the latest version from https://github.com/rust-lang/rustc_codegen_cranelift/releases/tag/dev instead, extract it somewhere and then run the contained cargo-clif.exe in the place of cargo.exe. |
I think it would be beneficial if there was a bigger notice in README.md that the usage instructions above the section mentioning precompiled binaries (for Windows) don't all easily transfer. I at least can't get rustc to accept the |
I added cargo-clif to C:\Users\User\Documents\code\rustduck\src-tauri>rustup default
nightly-x86_64-pc-windows-msvc (default)
C:\Users\User\Documents\code\rustduck\src-tauri>cargo-clif build
warning: `C:\Users\User\.cargo\config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
warning: `C:\Users\User\.cargo\config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Cpanic=abort -Zpanic-abort-tests -Zcodegen-backend=C:\apps\bin\cargo-clif\bin\rustc_codegen_cranelift.dll --sysroot C:\apps\bin\cargo-clif --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit code: 1)
--- stderr
error: the option `Z` is only accepted on the nightly compiler
help: consider switching to a nightly toolchain: `rustup default nightly`
note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>
note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>
error: 1 nightly option were parsed |
That was an issue with rustc. I reinstalled it and it got fixed. I compared build time with
|
Sorry for the late reply @mikkelens. With the precompiled binaries from the releases page you probably want to use cargo-clif.exe instead of using the cargo configs. |
I also have problems compiling for windows.
cargo-clif build gives me this: Compiling proc-macro2 v1.0.86 Compiling unicode-ident v1.0.12 Compiling cfg-if v1.0.0 Compiling serde v1.0.204 Compiling autocfg v1.3.0 Compiling windows_x86_64_gnu v0.52.6 Compiling getrandom v0.2.15 Compiling once_cell v1.19.0 error: linking with |
Does it work with the x86_64-pc-windows-msvc toolchain? I think the x86_64-pc-windows-gnu toolchain is missing all MinGW libraries. |
I'm not sure, what do you mean? I use "nightly" though I have a feeling that's not what you mean. |
Are you using the artifacts from https://github.com/rust-lang/rustc_codegen_cranelift/releases/tag/dev or are you using rustc_codegen_cranelift from rustup ( |
I think I'm already using it:
|
You downloaded the x86_64-pc-windows-gnu version of cg_clif rather than the x86_64-pc-windows-msvc version. Try using the x86_64-pc-windows-msvc version. |
That works, thanks! but now my game runs on 15 fps for some reason (it was bad already on windows, 45 fps, but still playable). Anyway it works on linux and quite well I must say. |
This is true and what I expected after having trouble with the other method. The problem though is that this doesn't (seemingly) make it possible to use cranelift for only the top level crate (incrementally compiled), like is recommended in most contexts (using LLVM for the dependencies). I also am not sure if dynamic linking (e.g. |
Yeah. I would like to see the rustup version work on windows too, but that is waiting on at least raw-dylib support (which someone is currently working on)
Dynamic linking should be supported. If not, that is a bug you can open an issue for. |
It's unclear how can I use this codegen in Windows.
I would like to use it both locally and on Github actions for faster build with Rust on Windows.
Does it improve speed for release builds?
rustup default nightly
What should I do after installing nightly rust and set it as deafult?
The text was updated successfully, but these errors were encountered: