-
Notifications
You must be signed in to change notification settings - Fork 892
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
"Can't find crate for rustc_*
" when cross-compiling a crate with rustc_private
on
#3255
Comments
What does Then, the contents of each of ~/.rustup/toolchains/*/lib/rustlib/components |
Sorry. I didn't get this one. Do you want the manifest files contents? |
Rustup writes to the file called components matching that glob. |
Yeah but I didn't get the each part. Anyways, this is the
|
I also had this issue where trying to cross-compile to i686-unknown-linux-gnu failed to find the std and core crates. Even though I used the Somehow using nightly messes up cross-compilation |
…c components (#28) I got bit by this when trying to build the CLI for the first time. Apparently, there's [a bug](rust-lang/rustup#3255) in `rustup` that causes components to not be installed when nightly is selected. Fortunately, installing them manually works just fine, so I added instructions for it to the README.
I'm seeing this issue too, but can't find a workaround. Neither manually adding components nor switching to stable, re-adding and switching to nightly, seem to help. I actually have a public repo that can be used to reproduce this, here's a permalink to a failing Github Action workflow: https://github.com/tombh/rust-gpu-cli/blob/4a2492a95759cf103f4c2f3f9e51a1c7d0866b06/.github/workflows/release.yml#L45 And a failing workflow run's logs: https://github.com/tombh/rust-gpu-cli/actions/runs/11373072910/job/31638834293#step:5:373 |
@tombh Thanks for the ping! However, It looks like you're not describing a toolchain corruption (the symbolic "failed to install component" message is missing from your log), but another scenario which is related to RustGPU usage specifically. I've found EmbarkStudios/kajiya#78 which looks similar, but I'm not completely sure what has caused the issue for you, especially since you're cross-compiling for another target... Is there any prior art in building RustGPU with PS: You have a typo in your script, it's |
Thanks for looking into this! So if I'm understanding the original bug report the issue arises before, and indeed can be reproduced without, the
In other words, this is how I believe the error can be stated: there appears to be no way in which I agree that the subsequent error (ie https://github.com/Rust-GPU/rust-gpu is the original, underlying repo. The thing to note is that the core of the project is a custom codegen backend, which is what necessitates the Ah yes, that was a typo in |
@tombh Thanks for your reply. Now that I think about it, it's less likely an issue specific to RustGPU, but common to nightly + Anyway, I'll find some time to do more investigation. Possibly related: os-checker/MIRAI#3 |
error[E0463]: can't find crate for
rustc_*` when cross-compiling a crate with
rustc_private` on
error[E0463]: can't find crate for
rustc_*` when cross-compiling a crate with
rustc_private` onerror[E0463]: can't find crate for
rustc_*`` when cross-compiling a crate with
rustc_private` on
error[E0463]: can't find crate for
rustc_*`` when cross-compiling a crate with
rustc_private` on error[E0463]: can't find crate for
rustc_*
when cross-compiling a crate with
rustc_private` on
error[E0463]: can't find crate for
rustc_*
when cross-compiling a crate with
rustc_private` onrustc_*
" when cross-compiling a crate with rustc_private
on
@tombh I just tried locally to add OTOH I do believe there is something wrong in the way Also, to add to the context, it is useful to note that This might require some effort on the release side, esp. regarding how |
Thanks for the update. Would it be useful to make a minimal reproducible repo? And can you think of any avenues for workarounds worth exploring? |
@tombh I think a minimal repro would be very useful indeed.
... it really has to do with the way Similar to #3717 (which is also related to incorrect packaging of component(s)), opening a new issue at https://github.com/rust-lang/rust might be helpful, as the actual packaging happens there IIRC. |
Thanks, great, so here's the minimal reproducible repo: https://github.com/tombh/nightly_cross_minimal_repro Pasting #![feature(rustc_private)]
extern crate rustc_ast;
extern crate rustc_driver;
extern crate rustc_macros;
fn main() {
println!("{}", rustc_ast::node_id::CRATE_NODE_ID)
} The build commands are here: https://github.com/tombh/nightly_cross_minimal_repro/blob/main/.github/workflows/ci.yml Pasting the most relevant part: rustup toolchain install nightly-2024-09-30
rustup default nightly-2023-09-30
rustup target add aarch64-unknown-linux-gnu
rustup component add rust-src rustc-dev-aarch64-unknown-linux-gnu llvm-tools
...
cargo -v build --locked --release --target aarch64-unknown-linux-gnu And here is the failing build: https://github.com/tombh/nightly_cross_minimal_repro/actions/runs/11463471346/job/31897390824#step:5:9 Also, just out of interest, here is a failing build with yesterday's nightly ( I can also reproduce the build errors locally on my aarch64 machine using: If you or anybody else can also reproduce this then I'll report it on https://github.com/rust-lang/rust too. |
This doesn't look like a rustup issue, might be rust or Cargo's. Any change you know which specific version of nightly toolchain starts having this failure? |
@weihanglo I guess the problem is there since forever, it's just that few have tried to use I've tried to find something similar in rust-lang/rust but I'm not quite there yet. Possibly related:
@tombh Thanks for your minimal reproduction. I can reliably reproduce this on my ARM64 Mac with the following error message: error[E0463]: can't find crate for `derive_where` which `rustc_ast` depends on
--> src/main.rs:3:1
|
3 | extern crate rustc_ast;
| ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `rustc_ast`
--> src/main.rs:4:1
|
4 | extern crate rustc_driver;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_macros`
--> src/main.rs:5:1
|
5 | extern crate rustc_macros;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview` It'd definitely be nice if a follow-up to rust-lang/rust#70838 can be filed. If it's not a valid use case to cross compile with |
Thanks for testing it out. I made an issue in the main Rust repo: rust-lang/rust#132728 |
Following the previous comments, I'm going to close this issue in favor of rust-lang/rust#132728, as this indeed looks more like a release-related problem. |
Problem
In our project, we are using
rustc
components. When building for ax86_64
target it's fine. However, when setting the target toi686-unknown-linux-gnu
, cargo (rustc) starts complaining about components not existing.I think this is a problem due to components installation through
rustup
. It doesn't look to be installing them for the specified target.The initial install is done through the following command.
However, during building rustup complaints as follows.
Trying to install components again raises a conflict issue.
Originally, we are using
rust-toolchain.toml
to define the components and targets. In both cases, these issues exist. Also tried installing it side by side thex86_64
target and the same issue exists.Steps
rustc
components.rust-toolchain.toml
to override the toolchain and define components and targets as follows.cargo build --target=i686-unknown-linux-gnu
.Possible Solution(s)
No response
Notes
No response
Rustup version
rustup 1.25.2 (17db695f1 2023-02-01)
Installed toolchains
The text was updated successfully, but these errors were encountered: