diff options
author | fanquake <fanquake@gmail.com> | 2021-11-16 10:05:02 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-11-16 10:05:17 +0800 |
commit | 6780759a01e25c68dd55044c3b9a016f9137910b (patch) | |
tree | 0ec5211e5937d4a227e908011823cf6a9e2f0498 | |
parent | 41e6909c073024e774e5f960f00ebd74758e9d2e (diff) | |
parent | 4ba492052ec09d48f8c3f391cc248340e761c7f2 (diff) |
Merge bitcoin/bitcoin#23478: build: Add support for Android NDK r23 LTS
4ba492052ec09d48f8c3f391cc248340e761c7f2 doc: Add minimum supported Android NDK version (Hennadii Stepanov)
6393bdcd53b106367b10317c227a114494c90142 doc: Move Android dependencies guide into `build-android.md` (Hennadii Stepanov)
ac323a7222efaafc7bc3110b02f1ef2d2635c9a2 build: Switch to llvm buinutils for Android builds (Hennadii Stepanov)
Pull request description:
The new Long Term Support release of the Android NDK is [available](https://groups.google.com/g/android-ndk-announce/c/MS6Qoub0DKE/m/Zfp5Ys8eAAAJ) since 2021-08-11:
> As r23 is the new LTS, the support windows for r21 and r22 have now ended.
On master (8ae4ba481ce8f7da173bef24432729c87a36cb70), dependency build fails because it expects GNU Binutils are present in the Android NDK. In [fact](https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils):
> GNU Binutils remains available up to and including r22. All binutils tools with the exception of the assembler (GAS) were removed in r23. GAS was removed in r24.
This PR switches our depends build system to llvm binutils. The usage of `llvm-ar` and `llvm-ranlib` tools effectively makes r21 the minimum supported version of NDK.
With this PR:
- building depends against NDK r23 LTS now is possible with `NO_QT=1`
- building the `qt` package in depends against NDK r23 LTS still fails:
```
Creating qmake...
...
ERROR: Cannot detect Android NDK toolchain.
Please use -android-toolchain-version to specify it.
```
The issue with the `qt` package is going to be addressed in another PR.
ACKs for top commit:
fanquake:
ACK 4ba492052ec09d48f8c3f391cc248340e761c7f2
Tree-SHA512: cdc8f95ff9a3ad7f12eb55b9ea18b6b6b800d4cceff7e0321985be6e39d15a2b2ea5b1592972307d76d111292a0ed58fd287e5ca285e2f6868b42a286536d310
-rw-r--r-- | depends/README.md | 14 | ||||
-rw-r--r-- | depends/hosts/android.mk | 7 | ||||
-rw-r--r-- | doc/build-android.md | 17 |
3 files changed, 19 insertions, 19 deletions
diff --git a/depends/README.md b/depends/README.md index 15c82cddf2..bd69768167 100644 --- a/depends/README.md +++ b/depends/README.md @@ -41,7 +41,7 @@ Common `host-platform-triplet`s for cross compilation are: - `i686-linux-android` for Android x86 32 bit - `x86_64-linux-android` for Android x86 64 bit -The paths are automatically configured and no other options are needed unless targeting [Android](#Android). +The paths are automatically configured and no other options are needed unless targeting [Android](../doc/build-android.md). ### Install the required dependencies: Ubuntu & Debian @@ -133,18 +133,6 @@ options will be passed to bitcoin's configure. In this case, `--disable-wallet`. download-linux: run 'make download-linux' to fetch all sources needed for linux builds -### Android - -Before proceeding with an Android build one needs to get the [Android SDK](https://developer.android.com/studio) and use the "SDK Manager" tool to download the NDK and one or more "Platform packages" (these are Android versions and have a corresponding API level). -In order to build `ANDROID_API_LEVEL` (API level corresponding to the Android version targeted, e.g. Android 9.0 Pie is 28 and its "Platform package" needs to be available) and `ANDROID_TOOLCHAIN_BIN` (path to toolchain binaries depending on the platform the build is being performed on) need to be set. - -API levels from 24 to 29 have been tested to work. - -If the build includes Qt, environment variables `ANDROID_SDK` and `ANDROID_NDK` need to be set as well but can otherwise be omitted. -This is an example command for a default build with no disabled dependencies: - - ANDROID_SDK=/home/user/Android/Sdk ANDROID_NDK=/home/user/Android/Sdk/ndk-bundle make HOST=aarch64-linux-android ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/home/user/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin - ### Other documentation - [description.md](description.md): General description of the depends system diff --git a/depends/hosts/android.mk b/depends/hosts/android.mk index eabd84bbbe..fcc1c4f5c3 100644 --- a/depends/hosts/android.mk +++ b/depends/hosts/android.mk @@ -1,12 +1,11 @@ ifeq ($(HOST),armv7a-linux-android) -android_AR=$(ANDROID_TOOLCHAIN_BIN)/arm-linux-androideabi-ar android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)eabi$(ANDROID_API_LEVEL)-clang++ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)eabi$(ANDROID_API_LEVEL)-clang -android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/arm-linux-androideabi-ranlib else -android_AR=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)-ar android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang -android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)-ranlib endif +android_AR=$(ANDROID_TOOLCHAIN_BIN)/llvm-ar +android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/llvm-ranlib + android_cmake_system=Android diff --git a/doc/build-android.md b/doc/build-android.md index 7a8a9e6a65..6d25e72fde 100644 --- a/doc/build-android.md +++ b/doc/build-android.md @@ -3,9 +3,22 @@ ANDROID BUILD NOTES This guide describes how to build and package the `bitcoin-qt` GUI for Android on Linux and macOS. -## Preparation -You will need to get the Android NDK and build dependencies for Android as described in [depends/README.md](../depends/README.md). +## Dependencies + +Before proceeding with an Android build one needs to get the [Android SDK](https://developer.android.com/studio) and use the "SDK Manager" tool to download the NDK and one or more "Platform packages" (these are Android versions and have a corresponding API level). + +The minimum supported Android NDK version is [r21](https://github.com/android/ndk/wiki/Changelog-r21). + +In order to build `ANDROID_API_LEVEL` (API level corresponding to the Android version targeted, e.g. Android 9.0 Pie is 28 and its "Platform package" needs to be available) and `ANDROID_TOOLCHAIN_BIN` (path to toolchain binaries depending on the platform the build is being performed on) need to be set. + +API levels from 24 to 29 have been tested to work. + +If the build includes Qt, environment variables `ANDROID_SDK` and `ANDROID_NDK` need to be set as well but can otherwise be omitted. +This is an example command for a default build with no disabled dependencies: + + ANDROID_SDK=/home/user/Android/Sdk ANDROID_NDK=/home/user/Android/Sdk/ndk-bundle make HOST=aarch64-linux-android ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/home/user/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin + ## Building and packaging |