I start a container to build my program...
docker run -it -v $PWD/my-project:/my-project rust:alpine
The host machine is a Raspberry Pi 4...
# uname -a
Linux pi-4 5.10.61-0-rpi4 #1-Alpine SMP PREEMPT Thu Aug 26 22:38:20 UTC 2021 aarch64 Linux
I build my project...
cargo build --release --target aarch64-unknown-linux-musl
Then I try to run the binary and it doesn't work...
# ./target/aarch64-unknown-linux-musl/release/ecr-creds-updater
/bin/sh: ./target/aarch64-unknown-linux-musl/release/ecr-creds-updater: not found
Inspecting the binary...
# file target/aarch64-unknown-linux-musl/release/ecr-creds-updater
target/aarch64-unknown-linux-musl/release/ecr-creds-updater: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, with debug_info, not stripped
Ok, so the interpreter doesn't exist...
# ls /lib/ld-linux-aarch64.so.1
ls: /lib/ld-linux-aarch64.so.1: No such file or directory
But I can fix that...
# apk add gcompat
# ls /lib/ld-linux-aarch64.so.1
/lib/ld-linux-aarch64.so.1
But now it complains about the async runtime...
# ./target/aarch64-unknown-linux-musl/release/ecr-creds-updater
thread 'main' panicked at 'Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.12.0/src/runtime/enter.rs:39:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)
Some things to note...
- I'm not trying to cross compile
- I'm not trying to statically link
- This exact same project works totally fine on OS X.
What's going on? Thanks for the help.