rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
54.01k stars 10.15k forks source link

Rustlings failed to install, linker 'cc' not found #2141

Closed LilacMonarch closed 2 weeks ago

LilacMonarch commented 2 weeks ago

Installing on WSL 2. Rustup installed fine with the default settings.

I tried the --locked argument too, nothing changed.

cargo install rustlings
    Updating crates.io index
  Installing rustlings v6.3.0
    Updating crates.io index
    Updating crates.io index
  Downloaded serde_spanned v0.6.7
  Downloaded proc-macro2 v1.0.86
  Downloaded unicode-ident v1.0.12
  Downloaded hashbrown v0.14.5
  Downloaded serde v1.0.209
  Downloaded toml_edit v0.22.20
  Downloaded serde_derive v1.0.209
  Downloaded indexmap v2.4.0
  Downloaded winnow v0.6.18
  Downloaded clap v4.5.16
  Downloaded syn v2.0.76
  Downloaded clap_builder v4.5.15
  Downloaded anyhow v1.0.86
  Downloaded once_cell v1.19.0
  Downloaded clap_derive v4.5.13
  Downloaded autocfg v1.3.0
  Downloaded rustix v0.38.35
  Downloaded libc v0.2.158
  Downloaded serde_json v1.0.127
  Downloaded 19 crates (2.6 MB) in 0.91s
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.158
   Compiling serde v1.0.209
   Compiling cfg-if v1.0.0
   Compiling log v0.4.22
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: could not compile `proc-macro2` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `serde` (build script) due to 1 previous error
error: could not compile `libc` (build script) due to 1 previous error
error: failed to compile `rustlings v6.3.0`, intermediate artifacts can be found at `/tmp/cargo-installuIOaF3`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
mo8it commented 2 weeks ago

From the README:

🐧 If you're on Linux, make sure you've installed gcc (for a linker). Deb: sudo apt install gcc

Please install gcc :)

LilacMonarch commented 1 week ago

Ah I'm stupid. Thought I had that installed but clearly not. Well that's embarrassing.

Thanks ^.^