Rustup: Installation fails on Ubuntu Touch tablet

Created on 5 Aug 2016  路  10Comments  路  Source: rust-lang/rustup

This is on a bq Aquarius M10 FHD device. I tried installing with the normal command, which gives me this:

$ curl https://sh.rustup.rs -sSf | sh
info: downloading installer
sh: 239: /run/user/32011/confined/com.ubuntu.terminal/tmp.DKpGrs2xNJ/rustup-init: not found
rustup: command failed: /run/user/32011/confined/com.ubuntu.terminal/tmp.DKpGrs2xNJ/rustup-init

The rustup-init executable is definitely there, and googling around makes it look like a 64 vs 32 bit issue. Unfortunately (and not unexpectedly), there are no lib32* packages available, which is the recommended solution for fixing the sh: ... not found issue.

This is what uname shows:

$ uname -a
Linux ubuntu-phablet 3.10.93+ #1 SMP PREEMPT Wed Jun 22 11:01:13 UTC 2016 aarch64 aarch64 aarch64 GNU/Linux
bug

Most helpful comment

I have the same kind of issue with an Alpine Linux on Docker...

All 10 comments

Thanks for the report @mechaxl !

Is the binary downloaded by rustup-init.sh for aarch64? I think file will tell that info.

Does the direct download for aarch64 work correctly?

Here's what file has to say about the version that got downloaded:

$ file rustup-init 
rustup-init: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 4.2.6, not stripped

diff also says that the link you pasted is identical to the one that got downloaded via rustup.sh.

Thanks. So weird. It looks like you are running aarch64 and have an aarch64 binary. I might suspect that the script is failing to make the binary executable but it looks like it tries really hard to guarantee that happens.

What happens when you try to run the executable I linked to previously directly?

This is what I get:

$ ls -la
... snip ...
-rwxrwxr-x  1 phablet phablet 9701624 Aug 11 18:24 rustup-init
phablet@ubuntu-phablet:~/Downloads$ chmod +x ./rustup-init 
phablet@ubuntu-phablet:~/Downloads$ ./rustup-init 
bash: ./rustup-init: No such file or directory

I have the same kind of issue with an Alpine Linux on Docker...

Are there any updates on this? Still seeing the same behavior on Alpine Linux/Docker:


/ # curl https://sh.rustup.rs -sSf | sh -s -- -y --with-target=x86_64-unknown-linux-mu
sl --disable-sudo --channel=nightly
info: downloading installer
sh: /tmp/tmp.ImFCOi/rustup-init: not found
/ #
/ #
/ # find / -type f -name 'rustup-init'
/ #

Question is: shouldn't rustup be a self-contained executable by default, and dynamically-linked to the runtime only where applicable (eg distro strictly enforcing GPL)?

Seeing the same thing, looks like an issue with dynamic library dependencies (Alpine uses busybox+muslc):

To get the error:

$ docker run -it alpine:latest
# apk update
# apk add curl
# curl https://sh.rustup.rs/ -sSf | sh 

Here's ldd output for rustup-init:

/lib64/ld-linux-x86-64.so.2 (0x555938c76000)
    libz.so.1 => /lib/libz.so.1 (0x7f38870c6000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x555938c76000)
    librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x555938c76000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x555938c76000)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /tmp/tmp.IdeafJ/rustup-init)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x555938c76000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /tmp/tmp.IdeafJ/rustup-init)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x555938c76000)
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_GetRegionStart: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_SetGR: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_GetDataRelBase: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: __register_atfork: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: __rawmemchr: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_DeleteException: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_RaiseException: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_FindEnclosingFunction: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_Backtrace: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_GetIPInfo: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_GetTextRelBase: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_Resume: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: __strtok_r: symbol not found
Error relocating /tmp/tmp.IdeafJ/rustup-init: _Unwind_SetIP: symbol not found

EDIT: Using apk add libc6-compat libgcc allows to go a bit further:

info: downloading installer
    /lib64/ld-linux-x86-64.so.2 (0x55de6ee05000)
    libz.so.1 => /lib/libz.so.1 (0x7f7969e06000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x55de6ee05000)
    librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x55de6ee05000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55de6ee05000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f7969bf4000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55de6ee05000)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55de6ee05000)
Error relocating /tmp/tmp.HDimHJ/rustup-init: __register_atfork: symbol not found
Error relocating /tmp/tmp.HDimHJ/rustup-init: __rawmemchr: symbol not found
Error relocating /tmp/tmp.HDimHJ/rustup-init: __strtok_r: symbol not found
Error relocating /tmp/tmp.HDimHJ/rustup-init: __register_atfork: symbol not found
Error relocating /tmp/tmp.HDimHJ/rustup-init: __rawmemchr: symbol not found
Error relocating /tmp/tmp.HDimHJ/rustup-init: __strtok_r: symbol not found

According to Docker Alpine Caveats:

In this case, the upstream would need to remove the support for this offending symbol or have the ability to compile the software natively on musl libc

I ended up just using an alpine with glibc. Here's one.

Different hardware here: LGE Nexus 5

Processor   : ARMv7 Processor rev 0 (v7l)
BogoMIPS    : 38.40
Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt 
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x2
CPU part    : 0x06f
CPU revision    : 0
Hardware    : Qualcomm MSM 8974 HAMMERHEAD (Flattened Device Tree)
Revision    : 000b
Serial      : 0000000000000000
phablet@ubuntu-phablet:~/Downloads/myut1test$ uname -a
Linux ubuntu-phablet 3.4.0-cyanogenmod-g2669fa0 #1 SMP PREEMPT Thu Nov 1 02:24:09 CET 2018 armv7l armv7l armv7l GNU/Linux

cargo new myut1test

rustup default nightly
info: using existing install for 'nightly-armv7-unknown-linux-gnueabihf'
info: default toolchain set to 'nightly-armv7-unknown-linux-gnueabihf'

  nightly-armv7-unknown-linux-gnueabihf unchanged - rustc 1.31.0-nightly (155510e37 2018-10-20)

phablet@ubuntu-phablet:~/Downloads/myut1test$ cargo build
   Compiling myut1test v0.1.0 (/home/phablet/Downloads/myut1test)                                                                                                                                                                            
error: linking with `cc` failed: exit code: 1                                                                                                                                                                                                
  |                                                                                                                                                                                                                                          
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.2d4pn70lsgl1uxzd.rcgu.o" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.2rvczkq9z18u8job.rcgu.o" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.2uw6t4f5f4205h2p.rcgu.o" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.3zaqmaktpl4nac49.rcgu.o" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.438fzbc9gwka2lnh.rcgu.o" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.4dkhbr2zhdft5g96.rcgu.o" "-o" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec" "/home/phablet/Downloads/myut1test/target/debug/deps/myut1test-0c5f32d9eae2dcec.4lz7dh5gnnlvt04g.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/phablet/Downloads/myut1test/target/debug/deps" "-L" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd-b7c47d9270f8eed6.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libpanic_unwind-b14adfc7b2c8fbfe.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liballoc_jemalloc-5c7843ac48a19eb0.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libunwind-7a7742130852413c.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liballoc_system-a083b7e9baf5c3d3.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liblibc-da606a812812d928.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liballoc-386a4d3a7ed4da35.rlib" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcore-b4a18adff00b7a2b.rlib" "-Wl,--end-group" "/home/phablet/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcompiler_builtins-00fdee66b549000a.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: cannot find Scrt1.o: No such file or directory                                                                                                                                                                        
          /usr/bin/ld: cannot find crti.o: No such file or directory                                                                                                                                                                         
          collect2: error: ld returned 1 exit status                                                                                                                                                                                         


error: aborting due to previous error                                                                                                                                                                                                        

error: Could not compile `myut1test`.                                

I would have tried to add "-L pathtoScrt1.o Scrt1.o" or " pathtoScrt1.o/Scrt1.o" but I found no cargo switch to help me explicitly add files to the linker at the linker stage. I only found add link search path and add module XXX which implies dylib:libXXX.so or static:libXXX.a which isn't what I want.

I have found similar linker difficulties when attempting to use the https://github.com/rawrasaur/rust-jdbc
and https://github.com/rawrasaur/rust-jvm. In that case it gets more confusing since the rust module is called jvm and the java sdk jvm it needs to link to is libjvm.so in java sdk path rather than in the cargo project path. I wanted to explicitly link the full path to the libjvm.so in the same manner as linking the full path to the above Scrt1.o, but found no way of doing so with cargo switches or the build.rs advanced linking techniques currently documented. the rust compiler wants to wrap whatever i provide with either libXXX.so or libXXX.a and wants me to provide a path directive to it. Please is there any way to get the cargo/rust compiler out of my way to get my explicit linker string directly to the appropriate non-rust linker without any rust/cargo intervention for both .so's and .o's?
i.e. I don't want to pass -L nor -l.

I want to pass for example gcc -o myexe main.o /blah/blah2/Scrt1.o /blah3/java/blah4/libjvm.so
So from within rust I want to pass "/blah/blah2/Scrt1.o /blah3/java/blah4/libjvm.so" directly to the gcc linker myself from within rust.

If I could do that, I could resolve some of my issues I believe.
There is another concern, the link order.
rust does not give me any power to link everything in the order that I request.
There should be some accommodations for that somewhere.
i.e. for that rust-jdbc, the link order was trying to grab -ljvm before I had any chance at linking anything else to overcome the issue with a library path resulting in the -ljvm not found error.

Thank you for listening.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

matthiaskrgr picture matthiaskrgr  路  3Comments

kornelski picture kornelski  路  3Comments

davidawad picture davidawad  路  3Comments

durka picture durka  路  3Comments