Install standard libraries for a cross target.

Section: Targets and cross-compilation

Add a Linux musl target

bash
bash
rustup target add x86_64-unknown-linux-musl
Explanation

You must usually add the target before cross-compiling to it.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Targets and cross-compilation
List available targets
Show supported target triples.
OpenIn sheetbashsame section
Add Apple Silicon target
Install support for macOS ARM builds.
OpenIn sheetbashsame section
Build for a target triple
Compile artifacts for a non-default platform.
OpenIn sheetbashsame section
Run is typically host-only
Build target-specific binaries for packaging instead of running them locally.
OpenIn sheetbashsame section
List installed toolchains
Display toolchains available on the machine.
OpenIn sheetbash1 tag match
Pin toolchain in version-controlled config
Check in a `rust-toolchain.toml` file.
OpenIn sheettoml1 tag match