-
Install Rustup
curl https://sh.rustup.rs -sSf | sh
Runrustc --version
to check if the installation is success, this command will install cargo too. -
Install Android targets
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
-
Install iOS targets
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios i386-apple-ios x86_64-apple-ios
- Install Xcode
- Install lipo
cargo install cargo-lipo
cargo install cbindgen
- Run
tools/ios-token-v2-build.sh
. Set the right DIR intools/ios-token-v2-build.sh
. After running this shell, the lib files will be compiled and copied to the directory you set before.
- Install Android SDK or use the SDK providing by Android Studio (you can find it in
/Users/$$your_username$$/Library/Android/sdk
on macOS) - Config
~/.cargo/config
[target.aarch64-linux-android]
ar = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar"
linker = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android22-clang"
[target.armv7-linux-androideabi]
ar = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar"
linker = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang"
[target.i686-linux-android]
ar = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar"
linker = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android22-clang"
[target.x86_64-linux-android]
ar = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android-ar"
linker = "/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android22-clang"
- Run
tools/android-build.sh
, and check the DIR environment variable inandroid-build.sh
too.