Rust E0463: can't find crate for std
The target triple has no standard library installed. Add the target with rustup, check the target string and link the right ABI.

Introduction & Quick Summary
A cross-compilation build fails before compiling a single line of your code:
error[E0463]: can't find crate for `std`
|
= note: the `wasm32-unknown-unknown` target may not be installed
= help: consider downloading the target with `rustup target add wasm32-unknown-unknown`Quick answer: the standard library is compiled per target, and the target you asked for has no std rlib available to the compiler. Either the target is not installed in the active toolchain, or the target genuinely has no standard library (bare-metal targets). The first case is one rustup command; the second is a #![no_std] project.
rustup target list --installed
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --releaseThe note under the error names the target, which is the piece of information the message itself leaves out. This guide covers how the toolchain stores targets, what to do when rustup is not the toolchain in use, which targets have no std at all, and how -Z build-std and cross fit in when the prebuilt path does not exist.
Core Mechanics, Signatures & Reproducible Setup
A Rust toolchain ships the compiler, cargo, rustdoc, and the standard library for one or more targets. The host target (x86_64-unknown-linux-gnu, aarch64-apple-darwin) always has std; additional targets are installed separately as .rlib files for that triple.
rustup show
# Rustup home: /Users/ryu/.rustup
# active toolchain
# stable-aarch64-apple-darwin (default)
# rustc 1.83.0
# installed targets:
# aarch64-apple-darwin
# x86_64-unknown-linux-gnucargo build --target <triple> looks for std for that triple inside the active toolchain's lib/rustlib/<triple>/lib. If the directory is missing, the compiler reports E0463 with the note shown above.
ls "$(rustc --print sysroot)/lib/rustlib"
# aarch64-apple-darwin components manifest-* ...
rustup target add aarch64-unknown-linux-gnu
ls "$(rustc --print sysroot)/lib/rustlib"
# aarch64-apple-darwin aarch64-unknown-linux-gnu components ...A reproducible case:
cargo new --lib demo && cd demo
cargo build --target wasm32-unknown-unknown
# error[E0463]: can't find crate for `std`
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown
# Compiling demo v0.1.0 ... Finishedrustc --print target-list lists every triple the compiler knows; rustup target list lists the ones with prebuilt std.
Key Comparison Table
| Target triple | Has prebuilt std | Typical use |
|---|---|---|
x86_64-unknown-linux-gnu | yes | servers |
aarch64-unknown-linux-gnu | yes | arm64 servers, containers |
wasm32-unknown-unknown | yes, without threads and files | browser modules |
wasm32-wasip1 | yes | WASI runtimes |
thumbv7em-none-eabihf | no | embedded Cortex-M |
aarch64-unknown-none | no | bare-metal arm64 |
riscv32imac-unknown-none-elf | no | embedded RISC-V |
| Situation | Right fix | Command |
|---|---|---|
| target not installed | add it | rustup target add <triple> |
target has no std | #![no_std] crate | none |
need std on a no-std target | nightly build-std | cargo +nightly build -Z build-std=std,panic_abort --target <triple> |
distro rustc without rustup | install rustup toolchain | rustup toolchain install stable |
| linker missing after the fix | install a cross linker | apt install gcc-aarch64-linux-gnu |
| CI image without targets | add targets in the image | rustup target add ... in Dockerfile |
| Error variant | Meaning | Next step |
|---|---|---|
| note names a target | target not installed | rustup target add |
note says target does not support std | no-std target | switch crate to no_std |
| error appears only in Docker | image uses a different toolchain | check rustc --version in the image |
error after rustup override | override points at a toolchain without the target | rustup target add in that toolchain |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Confirm that rustup is the toolchain in use
Distribution packages (apt install rustc, brew install rust) do not use rustup, so rustup target add fails with "no installed toolchains" or adds the target to a toolchain the build never runs:
which -a rustc cargo rustup
rustc --version
rustup show active-toolchainIf which rustc points at /usr/bin/rustc while rustup manages ~/.cargo/bin, either remove the distribution package or pin the path. CI images built with a slim Debian base often hit exactly this: rustup is absent, the compiler is the distro one, and no target can be added until rustup is installed.
2. Toolchain overrides and rust-toolchain.toml
A rust-toolchain.toml in the repository selects a toolchain for that directory, and each toolchain has its own target list. Adding a target to stable does not add it to the 1.75 pinned by the file:
[toolchain]
channel = "1.83.0"
targets = ["wasm32-unknown-unknown"]
components = ["rustfmt", "clippy"]Declaring targets here is the most reliable fix for teams and CI, because rustup installs them automatically when the directory is entered. Without the declaration, every new machine repeats the same failure.
3. WASM targets and their std
wasm32-unknown-unknown has std with limits: no threads by default, no filesystem, no system clock. Code that compiles natively can still fail after the target is installed, with a different error about unsupported APIs.
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown
# later: error: no method named `spawn` found for struct `std::thread::Builder`For server-side WASM, wasm32-wasip1 is the current name (it was wasm32-wasi until Rust 1.78); installing the old name on a new toolchain produces a "target not found" message rather than E0463. Confirm the name against rustup target list | grep wasm.
4. Bare-metal targets have no std at all
Targets ending in -none- or -none-eabi* do not ship std. Adding them with rustup succeeds for core and alloc, and the crate must opt out:
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
#[no_mangle]
pub extern "C" fn add(a: i32, b: i32) -> i32 {
a + b
}A binary crate for such a target also needs an entry point (usually from a runtime crate such as cortex-m-rt) and a linker script. Compiling ordinary std code for thumbv7em-none-eabihf cannot work by installing anything; the platform has no operating system for std to call.
5. -Z build-std when no prebuilt std exists
For a target with no published std (a custom JSON target, a new architecture, x86_64-unknown-none), nightly can build the standard library from source:
rustup +nightly component add rust-src
cargo +nightly build -Z build-std=core,alloc --target my-target.json --releaseInclude std in build-std only if the target can support it; for bare metal, core plus alloc is the realistic set. This is a nightly feature, so it belongs in a CI job pinned to a nightly date rather than in a stable build.
6. Cross linkers and cross
Installing the target provides std; linking still needs a linker for that platform. On Linux hosts:
sudo apt install gcc-aarch64-linux-gnu
cat >> ~/.cargo/config.toml <<'EOF'
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
EOFThe cross tool packages this in a container and is often faster than configuring linkers by hand. After a successful build, compare the resulting binaries or manifests with the diff checker when a container image starts failing only after a toolchain bump, and keep the relevant environment values in a checked file with the environment variable formatter.
Common Compilation/Runtime Mistakes & Version Gotchas
- Adding the target to the wrong toolchain.
rustup target addapplies to the active toolchain; a pinnedrust-toolchain.tomlor arustup overrideselects a different one. - Expecting
stdon-none-targets. The error is correct; the crate needs#![no_std]. - Assuming the host target needs installing. It is always present; an E0463 on the host target points at a corrupted toolchain (reinstall it) or a wrong
--sysroot. - Ignoring the linker. E0463 replaced by
linker 'cc' not foundmeans the target is installed and the cross toolchain is not. - Version notes.
wasm32-wasibecamewasm32-wasip1in Rust 1.78, with the old name kept for a transition period; scripts that pin the old name break on newer toolchains.-Z build-stdremains nightly-only. - Docker caches. A layer that runs
rustup target addbeforeCOPYkeeps working; one that runs it in a later stage does not affect the earlier build stage.
Official documentation: E0463 and the rustup cross-compilation guide.
Official references
primary documentationThe Rust documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Rust work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Rust guides
All Rust guidesRust E0061: this function takes 1 argument but 2 were supplied
E0061 counts arguments at the call site. Check the signature, method versus associated function, generic defaults, and trait impls that changed arity.
Rust E0282: type annotations needed
E0282 means inference ran out of information. Annotate the binding, add a turbofish to collect or parse, or fix the signature the value flows into.
Rust E0432: unresolved import
E0432 is a module graph problem: a missing mod declaration, a private parent or a wrong path. Fix the tree, not the dependency list.
Rust E0106: missing lifetime specifier
E0106 appears when a returned borrow has no input to borrow from. Name the lifetime in functions, structs and impls, or return owned data.
More in Rust
All Rust guidesThe guides filed next to this one in Rust, in library order.