How To Fix Rust “linker ‘cc’ not found” Error On Linux


Hello ,

Today I was testing a Rust programming language on my CentOS VM. so I tried to install it and use it with correctly installation in the installation guide article.

When i tried to excute a rust file called with command rustc , i got this error:

[root@unixcop test]# rustc 
error: linker `cc` not found
  = note: No such file or directory (os error 2)

error: aborting due to previous error


As you can see in the above output, Cargo couldn’t find cc compiler program to compile the given application. Since Rust does not include its own linker yet, you need to have a C compiler like gcc installed to act as the linker.

To install gcc on CentOS , simply run:

# yum groupinstall "Development Tools"

On Ubuntu:

$ sudo apt install build-essential

After installing gcc, the error “linker cc not found” is gone! And then I can be able to install the application without any issues.

If you still get the same error even GCC is already installed, install cmake and try again. Cmake is available in the official repositories of most Linux distributions.


$ sudo yum install cmake


$ sudo apt install cmake

to get confirm and be sure that everything is OK.. Install gcc and make

# yum install gcc make -y

Installing gcc and make solved the problem for me.

Thank you

unixcop Admin


Please enter your comment!
Please enter your name here

Latest articles

You might also likeRELATED

How to Count Number of Files and Sub-directories inside a Directory

Hi guys, In this article we will show you how to count the number of files and sub-directories in a directory using a tree command. Count number...

Find Top 10 IP Addresses Accessing Your Apache Web Server

In this post, you will learn how to Find Top 10 IP Addresses Accessing Your Apache Web Server- The monitoring access to your web server...

How to Install MongoDB in CentOS 8

Introduction MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL). MongoDB is a...