How can I make a rust binary run on android?

I want to build a command line utility runs on android by some terminal emulator or adb.

I configured linker and ar in cargo/config.
Runs cargo build and works well.
But the result binary can't run on android.
Because it's a dynamic elf file:
ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, with debug_info, not stripped
and android doesn't have /lib/ld-linux-aarch64.so.1 so it can't work.

what should I do?
How can I compiler a static binary on Android? (I tried -C target-feature=+crt-static) but no use.
Or is there any other way for me to solve this problem?
I can't even print Hello world now....

I don't need android stuff like apk or sth else, just a executable file, directly executes.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.