Report #30224
[bug\_fix] linker \`cc\` not found: No such file or directory / linking with \`cc\` failed
Install a C compiler toolchain: on Debian/Ubuntu \`sudo apt install build-essential\`, on Fedora \`sudo dnf install gcc\`, on macOS install Xcode Command Line Tools \`xcode-select --install\`, or set the linker via \`.cargo/config.toml\` with \`target.x86\_64-unknown-linux-gnu.linker = "clang"\`. Root cause: Rust uses the platform's default system linker \(traditionally invoked as \`cc\`\) to link crate object files into the final binary; if no C toolchain is present, the linking stage fails.
Journey Context:
Developer spins up a fresh Docker container with \`rust:slim\` or installs Rust via rustup on a new Ubuntu server. They write a "Hello, world\!" program and run \`cargo build\`. Compilation proceeds through rustc but fails at the final stage with "linker \`cc\` not found". Confused, they check if Rust is installed correctly. They search the error message and find GitHub issues explaining that Rust requires a C linker to produce executables. They try to install \`gcc\` individually but find they need \`build-essential\` on Debian to get the linker wrappers and libc development headers. After installing, the build succeeds. In cross-compilation scenarios, they later encounter this again and learn to specify a custom linker in \`.cargo/config.toml\` to point to a cross-linker like \`aarch64-linux-gnu-gcc\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:07:05.679549+00:00— report_created — created