The officially official Devuan Forum!

You are not logged in.

#1 2021-01-18 00:23:56

bimon
Member
Registered: 2019-09-09
Posts: 172  

Why rustc does not work under non root account?

Hello,

I have installed following versions of Rust packages:

ii  libstd-rust-1.34:amd64                                           1.34.2+dfsg1-1~deb9u1                                    amd64        Rust standard libraries                                                                                                             
ii  libstd-rust-1.41:amd64                                           1.41.1+dfsg1-1~deb9u1                                    amd64        Rust standard libraries                                                                                                             
ii  libstd-rust-dev:amd64                                            1.41.1+dfsg1-1~deb9u1                                    amd64        Rust standard libraries - development files                                                                                         
ii  rust-doc                                                         1.41.1+dfsg1-1~deb9u1                                    all          Rust systems programming language - Documentation                                                                                   
ii  rust-gdb                                                         1.41.1+dfsg1-1~deb9u1                                    all          Rust debugger (gdb)                                                                                                                 
ii  rust-lldb                                                        1.41.1+dfsg1-1~deb9u1                                    all          Rust debugger (lldb)                                                                                                                
ii  rust-src                                                         1.41.1+dfsg1-1~deb9u1                                    all          Rust systems programming language - source code                                                                                     
ii  rustc                                                            1.41.1+dfsg1-1~deb9u1                                    amd64        Rust systems programming language   

Compiling from root works fine, but from a non root user I get following error:

rustc main.rs
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "main.main.7rcbfp3g-cgu.0.rcgu.o" "m                                                                                      ain.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbf                                                                                      p3g-cgu.5.rcgu.o" "-o" "main" "main.4s37gsrti678ik8u.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/usr/lib/rust                                                                                      lib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-2b8ce385717c133f.rlib" "/us                                                                                      r/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-bfdb904b514c26fa.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-7519d6bf                                                                                      50917898.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-16e1de1aad2c3dfc.rlib" "/usr/lib/rustlib/x86_64-unknown-lin                                                                                      ux-gnu/lib/libbacktrace-8ed76b3ed1b96667.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-2b9293c7b8f41cd3.rlib" "/usr/lib/rustli                                                                                      b/x86_64-unknown-linux-gnu/lib/librustc_demangle-854234105dc1a978.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-a6a6d047de166dab.rlib                                                                                      " "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-1c0cf4a4fbb9635d.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-efaf138ef5c1d                                                                                      0b8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-e28446567bdd0cc8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_w                                                                                      orkspace_core-7d724940c36772e7.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-ef8dee7216df56b3.rlib" "-Wl,--end-group" "/usr/lib/rustlib                                                                                      /x86_64-unknown-linux-gnu/lib/libcompiler_builtins-a5f50861fed71e63.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpt                                                                                      hread" "-lutil" "-lutil"
  = note: collect2: fatal error: ld terminated with signal 4 [Illegal instruction]
          compilation terminated.

error: aborting due to previous error

Earlier I thought my old CPU is not supported by rust compiler, but since root is able to compile then CPU is not related to the problem?

Is it a simple test program, which should compile fine:

fn main() {                                                                                                                                                                                                                                 
    println!("Hello, world!");                                                                                                                                                                                                              
}  

Compiled binary under root displays what is expected when run:

./main 
Hello, world!

My system is after:

apt-get dist-upgrade -t=ascii-backports

Last edited by bimon (2021-01-18 19:15:19)

Offline

#2 2021-01-18 17:30:03

bimon
Member
Registered: 2019-09-09
Posts: 172  

Re: Why rustc does not work under non root account?

Well, I installed from Internet using standard method described at:

https://riptutorial.com/rust/example/27821/setting-up

and everything works fine.

Offline

#3 2021-01-18 17:50:53

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: Why rustc does not work under non root account?

I've just tested your sample program using the ASCII live ISO image and it compiles and runs just fine for the non-privileged user.

From this I can deduce that your system has been subtly broken by your reckless and excessive use of backported packages.

EDIT: I told you so tongue

Last edited by Head_on_a_Stick (2021-01-18 17:51:17)


Brianna Ghey — Rest In Power

Offline

Board footer