Trying to cross-compile from m1 Mac to a Raspberry Pi 3b
so I did use
"cargo build --target aarch64-unknown-linux-gnu"
error[E0463]: can't find crate for
= note: the
aarch64-unknown-linux-gnu target may not be installed
= help: consider downloading the target with
rustup target add aarch64-unknown-linux-gnu
error: cannot find macro
println in this scope
2 | println!("Hello, Docker 2!");
this error message pops up even I downloaded aarch64-unknown-linux-gnu
Overall I'm lost atm
You did run
rustup target add aarch64-unknown-linux-gnu?
Note that Rust/Cargo doesn't support cross-compilation of binaries and dynamic libraries out of the box (it can only make object files/static libraries). You will have to find and install a cross-linker and Linux system libraries on your Mac.
This is much easier with zigbuild or just compile in a virtual machine.
Thanks all of your helps guys
Finally I find out the problems between my brew downloaded rust and rustup update version. The rustc version had error to read other toolchanins. So I uninstalled rust by using "brew uninstall rust" and reinstall from the official site. And it work!! Thanks a lot again. Have a good one!