I installed Rust using the instructions in the documentation on my Debian 9.2 system and tried to compile the hello world example. The compilation failed with the following error:
$ rustc main.rs --verbose
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "main.main0.rust-cgu.o" "main.main1.rust-cgu.o" "-o" "main" "main.crate.allocator.rust-cgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-fe0b1b991511fcaa.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-3d7b10e850a67e89.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-28484309357fd6f1.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-751808ba756769d5.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-8cb97051d8238386.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-25cc9b024a02d330.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-d42e80cee81b06ce.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-78c21267a2dc15c1.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-0e1b544c94586415.rlib" "/home/frederick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0c5e3d6c117f8c44.rlib" "/home/frederick/.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: ld-wrapper: error: attempt to use impure library "/usr/lib/gcc/x86_64-linux-gnu/6/libgcc_s.so"
collect2: error: ld returned 1 exit status
The following is the output of running uname -a
on my system
Linux localhost 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux
I tried the following searches on google, but cannot seem to find anything useful:
- rustc AND ld-wrapper: error: attempt to use impure library
- rustc AND ld-wrapper: error: attempt to use impure library "/usr/lib/gcc/x86_64-linux-gnu/6/libgcc_s.so"
- rustc AND error: linking with
cc
failed: exit code: 1
lsb_release -a
reportingDescription: Debian GNU/Linux 9.3 (stretch)
. It could be as simple as their install script looking for hardcoded strings like "ubuntu" and not "debian". If you poke around perhaps you'll create a helpful patch. – J_H