Report #21029
[bug\_fix] linker \`cc\` not found: No such file or directory \(os error 2\) during cargo build
Install build-essential on Debian/Ubuntu, gcc/make on other systems, or set the C linker path. Root cause: Rust requires a C linker \(typically gcc/clang\) to link native libraries and the standard library, but minimal containers or fresh WSL installs lack these tools.
Journey Context:
Developer creates a fresh Docker container or WSL instance, installs rustup via curl, creates a new project with \`cargo new\`, and immediately runs \`cargo build\`. Instead of a successful build, they get a cryptic error about linker \`cc\` not being found. They search the error and discover that Rust does not bundle a linker. They install \`build-essential\` on Ubuntu or \`base-devel\` on Arch, after which the build succeeds. They realize that even for pure Rust code, the toolchain requires a system linker.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:42:34.912237+00:00— report_created — created