1

I am trying to run cargo on a RockPro64 (aarch64). I installed the toolchain using curl https://sh.rustup.rs -sSf | sh with the output:

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!

The toolchain seems to be correct as this Reddit post suggests. However, when running cargo (or any other bin in $HOME/.cargo/bin/cargo), I get this error:

error: command failed: 'cargo': No such file or directory (os error 2)

I tried to investigate further after following Rust musl Docker image cannot find Cargo without success. Here is the output of ldd $HOME/.cargo/bin/cargo:

libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xf6cc7000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xf6cb1000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xf6c8d000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xf6c15000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xf6c02000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xf6b14000)
/lib/ld-linux-armhf.so.3 (0xf7508000)

And the output of strace -f -e trace=execve cargo:

execve("/home/alexandre/.cargo/bin/cargo", ["cargo"], [/* 15 vars */]) = 0
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPC, si_addr=0xab460186} ---
syscall_397(0, 0, 0, 0xfff, 0, 0x5)     = -1 (errno 38)
execve("/home/alexandre/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/bin/cargo", ["/home/alexandre/.rustup/toolchai"...], [/* 20 vars */]) = -1 ENOENT (No such file or directory)
error: command failed: 'cargo': No such file or directory (os error 2)
+++ exited with 1 +++

Is this the correct toolchain or am I missing something?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Alexandre Marcq
  • 364
  • 4
  • 14
  • Does `/lib/ld-linux-armhf.so.3` exist on your system? Maybe you need to enable multilib support? – msrd0 Feb 14 '22 at 18:45
  • I did find `/lib/ld-linux-armhf.so.3` linking to `arm-linux-gnueabihf/ld-2.24.so`. How would I enable multilib support ? – Alexandre Marcq Feb 14 '22 at 22:18
  • I believe `ILL_ILLOPC` indicates that you are running a program that is compiled for a different architecture than you can support. – Shepmaster Feb 15 '22 at 19:13
  • @Shepmaster Are you suggesting that I should try another toolchain ? – Alexandre Marcq Feb 15 '22 at 20:53
  • I don't know enough about the various Arm flavors to really answer that. There's so much variation (soft / hard floats, v6 / v7 / v8, the various profiles, etc.) that I haven't had reason to investigate. – Shepmaster Feb 16 '22 at 02:23

1 Answers1

0

Looks like you are doing NATIVE aarch64 build, that is you are building on an aarch64 machine. I'm not sure whether rust support this now. Please try to setup build environment on x86_64 host and CROSS build for aarch64.