Hi,
I installed rust like a year back and I am updating it regularly. A week back I got an error
as in title. Full trace back is as follows.
error: linking with `cc` failed: exit code: 1 | = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice0.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice1.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice10.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice11.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice12.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice13.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice14.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice15.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice2.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice3.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice4.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice5.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice6.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice7.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice8.rust-cgu.o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.practice9.rust-cgu.o" "-o" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e" "/home/dinesh/projects/practice/target/debug/deps/practice-6f3c90a32c93c78e.crate.allocator.rust-cgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/dinesh/projects/practice/target/debug/deps" "-L" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-fe0b1b991511fcaa.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-3d7b10e850a67e89.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-28484309357fd6f1.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-751808ba756769d5.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-8cb97051d8238386.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-25cc9b024a02d330.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-d42e80cee81b06ce.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-78c21267a2dc15c1.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-0e1b544c94586415.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0c5e3d6c117f8c44.rlib" "/home/dinesh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-bd7cc5ada1e908e0.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" = note: /usr/bin/ld: cannot find Scrt1.o: No such file or directory collect2: error: ld returned 1 exit status
As it says Scrt1.o
file not found. I worked around and I figured the problem, to specify ld library path in bashrc.
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH
export LIBRARY_PATH
This works well in terminal. But If I am compiling the file in emacs using cargo package, I get the same error.
Well, even before compiling it complains on the first line as linking failed with cc.
Any help!
Thank you.