Open
Description
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue+is%3Aopen%2Cclosed and found no duplicates.
- I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.
Problem
This may be a very basic issue, but may be hard to properly fix for new users. As a Rust novice myself, I'm not sure if this is a problem with installer or docs. When following the Getting Started, as a user, I am met with an obtuse error before running a Hello, World!
demo:
# cargo run
Compiling hello-rust v0.1.0 (/hello-rust)
error: linker `cc` not found
|
= note: No such file or directory (os error 2)
error: could not compile `hello-rust` (bin "hello-rust") due to 1 previous error
Steps
The simplest way is to use Docker with a minimal Debian image, created ad-hoc using docker run --rm -it debian:testing bash
:
apt update && apt install curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer Welcome to Rust! #..... Rust is installed now. Great!
. "$HOME/.cargo/env"
(as nicely guided by the installer!)cargo new hello-rust && cd hello-rust
cargo run
<== produces error as shown aboveapt install build-essential
cargo run
<== runs correctlyCompiling hello-rust v0.1.0 (/hello-rust) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s Running `target/debug/hello-rust` Hello, world!
Possible Solution(s)
When running on Debian, it's as simple as installing build-essential
, which is a nice a bold shortcut to get all typical tools. However, I think Rustup should probably check for a missing linker and at least suggest it is missing?
Rustup version
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.87.0 (17067e9ac 2025-05-09)`
Installed toolchains
Default host: x86_64-unknown-linux-gnu
rustup home: /root/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (active, default)
active toolchain
----------------
name: stable-x86_64-unknown-linux-gnu
active because: it's the default toolchain
installed targets:
x86_64-unknown-linux-gnu
OS version
Debian 13.0 from debian:testing
image
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.0
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"