cargo-dist icon indicating copy to clipboard operation
cargo-dist copied to clipboard

"Can't find crate 'core'" when building artifacts via cross-compilation

Open LukeMathWalker opened this issue 9 months ago • 2 comments

Pavex has been using dist for building artefacts for a while. Yesterday, the "build-local-artifacts" steps for x86_64-unknown-linux-musl and x86_64-apple-darwin started to fail with the same error:

building x86_64-apple-darwin target, from aarch64-apple-darwin host, using cargo profile dist --workspace)
   Compiling proc-macro2 v1.0.93
   Compiling unicode-ident v1.0.17
   Compiling libc v0.2.170
   Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-apple-darwin`

Weirdly enough, the toolchain has been installed via rustup just prior to running that command:

running rustup to ensure you have x86_64-apple-darwin installed
info: downloading component 'rust-std' for 'x86_64-apple-darwin'
info: installing component 'rust-std' for 'x86_64-apple-darwin'

so that can't be the actual underlying issue.

You can find the full build logs for both jobs here and here.

Relevant information: I've just updated the project to Rust's 2024 edition, so I do wonder if that's related.

LukeMathWalker avatar Feb 24 '25 08:02 LukeMathWalker

Hm, although I see it ran rustup, I wonder if this is a sign that it didn't take your rust-toolchain.toml into account while doing that. That would handled ensuring it had the specific version of Rust with the 2024 edition. I see that file is in the lib directory, rather than the root; I'm not sure how sensitive dist is to its position.

mistydemeo avatar Feb 24 '25 21:02 mistydemeo

Hm, although I see it ran rustup, I wonder if this is a sign that it didn't take your rust-toolchain.toml into account while doing that. That would handled ensuring it had the specific version of Rust with the 2024 edition. I see that file is in the lib directory, rather than the root; I'm not sure how sensitive dist is to its position.

That's my guess as well, since my "patch" amounts to adding the target after having stepped into the libs directory. See here.

LukeMathWalker avatar Feb 25 '25 08:02 LukeMathWalker