Rust 1.90 and LLD

Hello,

I udpated with rustup the latest Rust version (I chose "complete" profile) and I'm trying to compile a simple crate (create simply with "cargo init") but I've the following error: error: linker cc not found.

I don't have "gcc" installed but I'v LLVM with lld in PATH.

Note: I'm on Fedora 42.

Regard,

You need either gcc or clang installed as linker driver. The new lld default only makes rustc tell gcc/clang to use lld as the underlying linker. You still need gcc or clang as wrapper to tell the linker where to find system libraries and which flags to link with. This is true for all unix platforms. Only on Windows, wasm and embedded platforms does rustc directly invoke the linker.

I've all LLVM suite in PATH, including clang and lld.

Cargo just uses cc by default without checking anything, so it won't notice there's clang in the path.

You will need .cargo/config.toml with:

[target.x86_64-unknown-linux-gnu]
linker = "clang"

or define CC=clang env var.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.