Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linker `cc` not found,

Tags:

ubuntu

rust

After installing First time rust on ubuntu try to run this program.

fn main() {
    println!("Hello, world!");
}

Error:

$ cargo run
   Compiling test1 v0.1.0 (/home/saad/Documents/Rust/test1)
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: could not compile `test1`.
like image 389
M Saad Sajid Avatar asked Nov 21 '19 16:11

M Saad Sajid


2 Answers

As mentioned in the message, the linker 'cc' is missing. You can install it using apt-get:

sudo apt-get install gcc

After the installation completes, the problem should be solved.

like image 98
M Saad Sajid Avatar answered Sep 23 '22 13:09

M Saad Sajid


Your system is missing a C linker, which Rustup assumes that you already have. You can install one (among other potentially useful tools, like make) via the following command:

sudo apt install build-essential

like image 36
Newbyte Avatar answered Sep 24 '22 13:09

Newbyte