Distribute cg_clif as rustup component on the nightly channel by bjorn3 · Pull Request #81746 · rust-lang/rust (original) (raw)
I can't be the only one with this question - how does one actually put this to use after
rustup component add rustc-codegen-cranelift-x86_64-unknown-linux-gnu
?
That looks like you are mixing the cranelift codegen backend component with the compilation target toolchain.
Edit: I thought #117328 landed by
rustc 1.75.0-nightly (608e9682f 2023-10-29)
but I guess not. Once it does, seems it will just work by passing rustc-Zcodegen-backend=??
As github sais this was merged two days ago I would have expected this to be in the current nightly and based on the PR description I would expect the following to work
- depending on whether nightly is installed
a.rustup toolchain install nightly
b.rustup toolchain update
rustup component add rustc-codegen-cranelift-preview --toolchain nightly
RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build
1b and 2 succeeded the later suprisingly quickly, but 3 failed with
$ RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/home/bennet/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -Zcodegen-backend=cranelift --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 status: 1)
--- stderr
error: failed to find a `codegen-backends` folder in the sysroot candidates:
* /home/bennet/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
* /home/bennet/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu