$ rustup target add armv7-unknown-linux-uclibceabi
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not support target 'armv7-unknown-linux-uclibceabi'
note: you can see a list of supported targets with rustc --print=target-list
note: if you are adding support for a new target to rustc itself, see Adding a new target - Rust Compiler Development Guide
rustc target-list can get the armv7-unknown-linux-uclibceabi target, but rustup target add failed, what's the meaning of that?
in short, it is a target that the compiler backend (llvm) can generate code for, but the prebuilt standard libraries is not available to download via the official rustup.
in order to cross compile for the target, you need to build the standard library from source, this is not very difficult to do:
first make sure you are using nightly toolchain:
rustup default nightly
then make sure the rust-src component is installed:
rustup component add rust-src
configure cargo to use the cross compiler toolchain, example of .cargo/config.toml.:
[target.armv7-unknown-linux-uclibceabi]
cc = "/opt/cross-compiler/bin/arm-unknown-linux-uclibcgnueabi-gcc"
linker = "/opt/cross-compiler/bin/arm-unknown-linux-uclibcgnueabi-gcc"
in my experience, linker is mandatory, other tools (such ar, cxx etc) may or may not be required.
build your project with the cargo command line flag -Z build-std and --target, e.g.: