> [!NOTE] > This guide assumes that you're building for aarch64-linux-android only, but a similar approach should apply to other CPU architectures too. To build and run lune for android, you need to do the following: - Set up your cargo config: ```toml [target.aarch64-linux-android] ar = "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar" rustflags = ["-C", "linker=aarch64-linux-android-clang", "-C", "link-args=-rdynamic", "-C", "default-linker-libraries"] linker = "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-clang" ``` - The latest android NDK has paths different from those that cargo expects, so we need to create the following symlinks: - `$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar -> aarch64-linux-android-ar` - `$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang -> aarch64-linux-android-clang` - Make sure that `$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin` is in your path. - Build the binary: ```sh cargo build --release --target aarch64-linux-android ``` - The compiled output can be found at: `./target/aarch64-linux-android/release/lune` - To run lune, we'll need `libc++` for the linker as `libc` is always linked dynamically by cargo. We can find the library at `$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so`. - On android, store the `libc++_shared.so` file at `$PREFIX/lib/libc++_shared.so`. - Add the `$PREFIX/lib` to LD_LIBRARY_PATH. ```sh export LD_LIBRARY_PATH=$PREFIX/lib ``` - Run lune. - Profit?