Cross Compiling
This page contains special cross compiling instructions from Linux to other platforms. All of the commands in this documentation were tested in Arch Linux. If you have any issue building for a specific platform, please open an issue and we may be able to help.
Android
Note
Android compilation does not work at the moment
- Install the Android NDK. On Arch this can be installed via the android-ndk AUR package.
- Install cargo-ndk with
cargo install cargo-ndk
. - Install the toolchains you wish to build for:
Now you can build for whatever target you'd like using the cargo ndk
command. You must supply the TARGET_CMAKE_TOOLCHAIN_FILE
environment variable. On my system with the AUR package installed, that would be TARGET_CMAKE_TOOLCHAIN_FILE="/opt/android-ndk/build/cmake/android.toolchain.cmake"
. Here is an example command to build Squiid for armv7-linux-androideabi
:
TARGET_CMAKE_TOOLCHAIN_FILE="/opt/android-ndk/build/cmake/android.toolchain.cmake" cargo ndk --platform 33 --target armv7-linux-androideabi build --release
Please check the cargo-ndk documentation for more examples.
AArch64 MUSL
When compiling to the target aarch64-unknown-linux-musl
you may need to use special compiler flags to get it to compile successfully if you get an error when compiling normally. After installing the AArch64 MUSL C toolchain (gives you files like aarch64-linux-musl-gcc
), compile the project by running: