Solution To Solve Rust “linker ‘cc’ not found” Error On Linux systems

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

This post is about Solution To Solve Rust “linker ‘cc’ not found” Error On Linux systems

Introduction

Hello Guys, Many of us almost using Rust on daily tasks or something like that.

While you are using a Rust programming language on Linux e.g CentOS VM.

If you want to install it and use it with correctly installation, you can find it at the following link: the installation guide article.

After the installation, try to test the Rust Programming language by excuting a rust file e.g

For example: unixcop.rs with command rustc , If you got this error:

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

error: aborting due to previous error

I will tell you a solution to overcome this error.

Solution

The result of rustc command refers to that the Cargo couldn’t find cc compiler program to compile the application you have already created.

BTW, Cargo is the Rust package manager. Cargo downloads your Rust package’s dependencies, compiles your packages, makes distributable packages, and uploads them to crates.io, the Rust community’s package registry. You can contribute to this book on GitHub.

By default, Rust does not have a linker, So you need a compiler such as gcc or make to do the linker does.

So run the following command to install gcc

On CentOS,RHEL:

sudo yum groupinstall "Development Tools"
sudo yum install cmake make gcc -y

On Ubuntu:

sudo apt install build-essential -y
sudo apt install make gcc cmake -y

Now the Rust have a compiler so now you can install your application correctly.

Solve Rust error – Conclusion

In this article, we showed you how to get rid of the error message after you install the rust on Linux then try to install a rust application.

Thank you

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
MQ-Jr
MQ-Jr
unixcop Admin

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook