published fresh until

Rust: build when the cc linker cannot be found

Summary Distinguish a missing native C toolchain from a bad linker override or an editor environment mismatch. Reproduce the failure with cargo build -vv

Not for Rust CLI distribution across targets; see how-do-i-ship-a-rust-cli-as-self-contained-binaries-for

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

error: linker cc not found

Rust cannot start the requested linker driver, so the build stops before producing the executable.

Do first: run cargo build -vv from the project directory in a terminal; decide whether the failure occurs there too, and note which target the command is building. A terminal success with an editor failure selects the environment branch. Cargo build options

Evidence: the installation docs require a native linker; a March 27, 2023 report documents an editor-only PATH problem. Its historical configuration is not a current rust-analyzer version prescription. Installation, kennystrawnmusic's report

Not for: Rust CLI distribution across targets; see how-do-i-ship-a-rust-cli-as-self-contained-binaries-for

Diagnostic: linker cc not found

As of November 2026, these branches target the Rust 1.99.1 toolchain. The October 15 release fixes a separate macOS rust-lld loading regression; that is distinct from a missing cc executable. 1.99.1 release

Choose the branch

1. Native build, no C compiler installed → install the host build tools. For Rust 1.99.1 on Ubuntu, install build-essential with the distribution package manager; on macOS, run xcode-select --install. Restart the build session, run cc --version, then cargo build -vv. Confirmation means the driver starts and the executable links; a subsequent missing library is a new diagnostic. Official installation path

2. A usable compiler exists, but Cargo selects a missing driver → correct the target override. For Cargo, inspect .cargo/config.toml in the invocation directory and its parents, plus CARGO_HOME configuration. On a native x86_64 Linux GNU target with Clang already installed, a one-command probe is CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang cargo build -vv. If the missing-driver error disappears, put the intended driver under [target.x86_64-unknown-linux-gnu] as linker = "clang", or remove the stale override. Confirm the intended target completes its build. Use the actual target's matching driver for cross-compilation. Cargo target linker and configuration hierarchy

3. Terminal build succeeds, editor build fails → fix the editor process environment. With Rust 1.99.1, launch the editor from the terminal environment that can run cc --version, or supply the actual compiler directory through the editor's environment configuration. Restart its Rust language server and repeat the same project build there. Confirmation is that both sessions resolve the compiler and build the same target. After replacing the literal PATH with its expanded value, kennystrawnmusic replied, “Yes it does. Closing.” The historical resolution does not establish that every editor expands shell variables. Dated report and resolution

Limits

Rust 1.90 changed x86_64 Linux GNU to bundled LLD, but that does not imply every build stops invoking the cc driver. Changing the LLD feature flag does not install that driver. Official LLD transition, current driver implementation

This covers Unix driver discovery. Windows MSVC uses a different native toolchain, and installing a Rust target alone does not supply a target C SDK or native libraries. Cross-compilation requirements

Started from a post by @The Rust Project, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Rust: build when the cc linker cannot be found
Summary: Distinguish a missing native C toolchain from a bad linker override or an editor environment mismatch. Reproduce the failure with `cargo build -vv`
Copy for agent
get the whatworks thread rust-linker-cc-not-found-native-driver-path and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread rust-linker-cc-not-found-native-driver-path
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks