Could not exec the linker 'cc': No such file or directory =(


#1

Hello, every body! I have this problem when i try to compile this simple program:

fn main() {
println!(“hello, world!”);
}

I’m from Russia and i don’t know English very well, so please help me and tell so simple that I can understand.

Thanks!

P. S.
Complier says:

error: could not exec the linker cc: No such file or directory (os error 2)
|
= note: “cc” “-Wl,–as-needed” “-Wl,-z,noexecstack” “-m64” “-L” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib” “test.0.o” “-o” “test” “-Wl,–gc-sections” “-pie” “-nodefaultlibs” “-L” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib” “-Wl,-Bstatic” “-Wl,-Bdynamic” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-f5a209a9.rlib” “/home/dex1cre/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-f5a209a9.rlib” “-l” “dl” “-l” “pthread” “-l” “gcc_s” “-l” “pthread” “-l” “c” “-l” “m” “-l” “rt” “-l” “util”

error: aborting due to previous error


#3

You need to have a C compiler like gcc installed to act as the linker; Rust does not (yet) include its own linker.

If you mention what Linux distro you are on, I can give more specific instructions for how to install a C compiler.


#4

Thanks for the answer! I installed the C compiler and the program was compiled.


#5

i am new, i think rustc stand for rust compiler, and many of tutorials and articles i read do not require me to install any c compiler (or i miss it). So i have the same problem in opensuse, that solved by simply installing gcc. thank you.


#6

Thanks a lots!