I'm using ubuntu 20.04.
rust version
❯ rustc --version --verbose
rustc 1.71.0 (8ede3aae2 2023-07-12)
binary: rustc
commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225
commit-date: 2023-07-12
host: x86_64-unknown-linux-gnu
release: 1.71.0
LLVM version: 16.0.5
file name file.rs
fn main(){
println!("Hello World!");
}
when I run command rustc file.rs
there are error appear
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/ikrom/.cargo/bin:/home/ikrom/command-central/CommandCentral/client/bin:/home/ikrom/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/ikrom/bin:/usr/bin/java/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcJQAL9c/symbols.o" "file.file.34d691a9eaaa1d91-cgu.0.rcgu.o" "file.file.34d691a9eaaa1d91-cgu.1.rcgu.o" "file.file.34d691a9eaaa1d91-cgu.2.rcgu.o" "file.file.34d691a9eaaa1d91-cgu.3.rcgu.o" "file.file.34d691a9eaaa1d91-cgu.4.rcgu.o" "file.file.34d691a9eaaa1d91-cgu.5.rcgu.o" "file.1hs7aqwua5pqej5m.rcgu.o" "-Wl,--as-needed" "-L" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-0d91c78a7710ed2e.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-9bfeb974ba4dc4e7.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-7dd2d47ddb5fff81.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-18d5ce8e8a320b85.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-69d2770595dc6161.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-b156a020cc470e38.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-84091f15e468b1ee.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-fbde6acb28b510ca.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-e9de5d8ee4e7a3dd.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-9023252e4f119830.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-fcbb01769e88af40.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-f69e84994e245fea.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-27b55c02caca49ea.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-579b26075cbe9eca.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-54c30397d4b33d3b.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-65fb576691133eee.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3fff6412017c0b89.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-fd3918c72578db43.rlib" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-2a597573799b576f.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/ikrom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "file" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: SEVERE: Invalid params.
error: aborting due to previous error
then after that, many file comes with prefix file.random.rcgu.o

anyone please help me
I was trying to uninstall and install again rust but same.
method I was try to install rust is
sudo apt install rustc
and also install using this command
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Hello everyone I have been found the solution look this https://users.rust-lang.org/t/cant-compile-in-rust/97000/11
Rust requires CC for linking.
Install
build-essentialpackage to install common tools required for devOr you can also opt in to install only CC with
I would recommend the installing
build-essential** IMPORTANT
Once installed don't forget to
As in some cases I have some corruptions in target dir preventing subsequent cargo run
Now you should be good with
OUTPUT: