Report #53754
[bug\_fix] linker \`cc\` not found during cargo build
Install the C compiler toolchain: \`sudo apt-get install build-essential\` on Debian/Ubuntu, or \`gcc\`/\`clang\` on other systems. Root cause: Rust requires a system linker \(cc/gcc/clang\) to link native code, including the standard library and any C dependencies, into the final executable.
Journey Context:
You install Rust via rustup on a fresh WSL Ubuntu instance or a minimal Docker container. You run \`cargo new project && cargo build\` and immediately encounter an error: "linker \`cc\` not found". You check \`which gcc\` and find nothing installed. You realize that while rustc compiles Rust code to LLVM IR, the final step requires a system linker to produce an ELF binary. You install \`build-essential\` which provides \`cc\` \(a symlink to gcc\) and the standard C library. Upon retrying, cargo successfully invokes the linker to combine the compiled crates into the executable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:43:25.667590+00:00— report_created — created