Has anybody installed Rust using rustup on Patchbox-os?

Friends

I am getting a failure using rustup to install on Patchbox-os

I have done this many times before but not for 6-months, and it has always just worked. Not this time. I am at a loss.

I get this error towards the end of the process stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)

When I try to run cargo help after I get: error: command failed: 'cargo': No such file or directory (os error 2)

cargo is on my path, executable programme:

patch@patchbox:~ $ which cargo
/home/patch/.cargo/bin/cargo
patch@patchbox:~ $ ls -l `which cargo`
-rwxr-xr-x 14 patch patch 13370420 Oct 13 22:45 /home/patch/.cargo/bin/cargo
patch@patchbox:~ $ file `which cargo`
/home/patch/.cargo/bin/cargo: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.101, with debug_info, not stripped
patch@patchbox:~ $ 

This is the tail end of source ./rustup.sh

info: installing component 'rustfmt'
info: default toolchain set to 'stable-aarch64-unknown-linux-gnu'

  stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"
patch@patchbox:~ $ source "$HOME/.cargo/env"
patch@patchbox:~ $ cargo help  
error: command failed: 'cargo': No such file or directory (os error 2)

This error can happen when one of the executable dependency files are not found on the system. You can verify this by running:

strace cargo

This will log out every system call that’s made, it should help close in on the issue.

You may also have to do a little inception and run something like this instead to get a better idea of which file exactly is not found:

strace /bin/sh -c "source /home/patch/.cargo/env && cargo"

There will be a lot of output, so you may want to forward it all to a file (add > strace.log 2>&1 at the end of the command), inspect the end of the log file for clues. Keep in mind that some logged errors are normal to have, as it may be trying many paths for files in a loop before finding the correct one, so don’t worry about every one of the logged errors. :slight_smile:

I’m not sure if this picks up the case when it can’t find the appropriate ld.so loader for the executable. Such mismatch can happen when some executable gets built (or downloaded) for wrong architecture

The problem turns out to be that rustup has a bug in that it dd not recognise that PatchboxOS is 32-bit

Setting the tool chain to stable-arm-unknown-linux-gnueabihf fixed the problem

1 Like