Add instructions for building libupdater.a with Flutter's NDK
Flutter uses a very old NDK (v16 iirc) but thankfully it pulls down it's Android NDK into third_party/android_tools/ndk. Update our instructions to explain how to use that ndk when building. If we don't link against that ndk the arm64 version seems to work fine, but the arm32 version seems to depend on an extra symbol which the older ndk does not expose. Linking against the correct ndk gets rust to do the right thing. There was a separate change to fix a *second* missing symbol caused by the ring crate (from rustls, from reqwests) depending on getauxval, but that we changed by exposing a stub copy from the flutter engine code for now.
This commit is contained in:
@@ -76,21 +76,41 @@ The best way I found was to install:
|
||||
https://github.com/bbqsrc/cargo-ndk
|
||||
|
||||
```
|
||||
rustup install beta
|
||||
cargo +beta install cargo-ndk
|
||||
rustup +beta target add \
|
||||
cargo install cargo-ndk
|
||||
rustup target add \
|
||||
aarch64-linux-android \
|
||||
armv7-linux-androideabi \
|
||||
x86_64-linux-android \
|
||||
i686-linux-android
|
||||
cargo +beta ndk --target aarch64-linux-android build --release
|
||||
cargo ndk -t armeabi-v7a -t arm64-v8a build --release
|
||||
```
|
||||
|
||||
When building to include with libflutter.so, you need to build with the same
|
||||
version of the ndk as Flutter is using:
|
||||
|
||||
You'll need to have a Flutter engine checkout already setup and synced.
|
||||
As part of `gclient sync` the Flutter engine repo will pull down a copy of the
|
||||
ndk into `src/third_party/android_tools/ndk`.
|
||||
|
||||
Then you can set the NDK_HOME environment variable to point to that directory.
|
||||
e.g.:
|
||||
```
|
||||
NDK_HOME=$HOME/Documents/GitHub/engine/src/third_party/android_tools/ndk
|
||||
```
|
||||
|
||||
Then you can build the updater library as above. If you don't want to change
|
||||
your NDK_HOME, you can also set the environment variable for just the one call:
|
||||
```
|
||||
NDK_HOME=$HOME/Documents/GitHub/engine/src/third_party/android_tools/ndk cargo ndk -t armeabi-v7a -t arm64-v8a build --release
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Uses cbindgen to generate the header file.
|
||||
|
||||
It isn't currently wired into the build process, so you'll need to run it manually if you change the API.
|
||||
It isn't currently wired into the build process, so you'll need to run it
|
||||
manually if you change the API.
|
||||
https://github.com/shorebirdtech/shorebird/issues/121
|
||||
|
||||
```
|
||||
cargo install cbindgen
|
||||
|
||||
Reference in New Issue
Block a user