Porting to other platforms
Local Desktop only ships binaries for arm64-v8a. That covers almost every Android phone and tablet sold today. If you want to run it somewhere else, for example an x86_64 Android emulator or a Chromebook, you have to build it from source, and rebuild every native library it bundles.
This is an advanced topic, and nobody has done it end to end recently. Prepare to fix cross-compilation issues, and please share what you learn by editing this page.
What is arm64-only
Local Desktop's own code is Rust and Java, so it builds for any target Rust supports. The problem is everything else in the APK, which is prebuilt for arm64:
| What | Where | How it's built |
|---|---|---|
| PRoot and its loader | assets/libs/arm64-v8a/libproot.so, libproot_loader.so | patches/build-proot-android/ |
| libxkbcommon | assets/libs/arm64-v8a/libxkbcommon.so | patches/build-libxkbcommon/ (Docker) |
| PipeWire, WirePlumber and their modules | assets/libs/arm64-v8a/ (see PIPEWIRE_ASSETS_MANIFEST.txt) | Taken from Termux packages |
| The PipeWire AAudio sink | assets/libs/arm64-v8a/ | scripts/build-pipewire-aaudio-sink.sh |
| The guest's GPU drivers | assets/guest-mesa.tar.xz | patches/build-mesa/ (Docker, --platform linux/arm64) |
| The dynamic loader for the guest | assets/ld-linux-aarch64.so.1 | From Arch Linux ARM |
On top of that, build.rs links against ./assets/libs/arm64-v8a, and the Arch Linux root filesystem that the app downloads (src/core/config.rs) is the aarch64 one. Both need to change for another architecture. The GPU drivers (Turnip) only make sense on Qualcomm Adreno GPUs anyway, so you can skip them on other platforms: Local Desktop falls back to software rendering.
Rebuild the libraries
libproot.so and libproot_loader.so
-
Set
$ANDROID_NDK_HOMEto your Android NDK. -
In
patches/build-proot-android/config, changeARCHS='aarch64'to your target architecture. -
In
patches/build-proot-android/make-proot-assets.sh, change theassets/libs/arm64-v8afolder to your target's ABI folder (for examplex86_64). -
Build:
cd patches/build-proot-android/
./build.sh
The script copies and strips libproot.so and libproot_loader.so into the assets folder for you. On Android, executables inside an APK have to be named lib*.so, or the system won't extract them, which is why PRoot is called libproot.so.
libxkbcommon.so
-
Make sure Docker is installed.
-
Build:
cd patches/build-libxkbcommon
./build.sh -
Copy
patches/build-libxkbcommon/output/lib/libxkbcommon.sointo yourassets/libs/<abi>/folder.
The Dockerfile compiles in the path where the guest's XKB data lives, /data/data/io.github.localdesktop/files/arch/.... If you change the package name in manifest.yaml, change it there too. See the XKB bug for why.
libwayland.so
Not needed. Smithay implements the Wayland server in pure Rust, so there's no libwayland-server.so to cross-compile.
Build Local Desktop
If you unzip a Local Desktop APK, you will find lib/arm64-v8a/liblocaldesktop.so. That's where all the Rust code goes: the crate is a cdylib that Android's NativeActivity loads, and android_main is its entry point.
Normally you would build the .so with cargo, write an AndroidManifest.xml, and zip everything into an APK. xbuild does all of that from manifest.yaml. Once the libraries above are in assets/libs/<abi>/, build with:
x build --release --format apk --platform android --arch <arch>
The APK is in target/x/release/android/gradle/app/build/outputs/apk/release/app-release.apk.