How can I build Rust dev environment on Android Termux

I have seen many topics about this, but I still not understand how to make it :frowning:. Install from pkg install rust can works, but the version is too low. Rustup is not support aarch64-linux-android host triple, I have attempted many ways such as using aarch64-unknown-linux-gnu and compile from source but none of which works. So is there a way to use Rust on Android?
(Add: I'm not mean to generate APK, but just the binary executable file)

Looks like that cross-compilation is the only way for now, and even this might be tricky. I've tried it too, but run into multiple linker errors. I recall some version of Rust being built by its-pointless (here are links to their repo), but I'm not sure how fresh is it.

Thanks for reply. But I think the given link just means using pkg install rust and the highest version I could gain is 1.38.0 due to my low android version. One of my friends later told me to install an ubuntu (about 50MB) on termux and install Rust in it with rustup. Thankfully it worked well, so I think it might be a nice solution. You might as well try above method if you haven't resolve it yet.

I've gotten success by using an arch Linux environment through termux. Here's a link to a repo with the install script I used.

Yea but I have installed Ubuntu, which may work similarly. Install a real Linux is indeed a good solution. Thanks for answering :slight_smile:

1 Like