After the last
rustup update, cargo doesn't want to cross compile my projects to different targets, other than the local one.
error[E0463]: can't find crate for `core`
= note: the `x86_64-pc-windows-gnu` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-pc-windows-gnu`
(and 100+ errors follow)
I do have the target
x86_64-pc-windows-gnu installed, I even removed it and installed again, and even tried removing and reinstalling rustup with all the things and it didn't help.
Same happens when trying to cross-compile to x86_64-apple-darwin.
I'm on Ubuntu 22.04 LTS.
Does anyone else have this problem?
Any other things to try?
Have you made sure that you are using the same channel as you installed the targets on?
rustup target list give you?
$ rustup target list
$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/pkolaczk/.rustup
installed targets for active toolchain
rustc 1.60.0 (7737e0b5c 2022-04-04)
Looks like I had to install toolchains, not targets.
The hint given by cargo about missing target was simply wrong. Maybe this is an idea for cargo diagnostics improvement - is it not possible to detect missing toolchain?
No idea why the toolchains messed up in the first place, when I had everything working before, but definitely after reinstalling everything from scratch I forgot to do:
rustup toolchain install stable-x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-apple-darwin
So running those commands has helped.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.