Page MenuHomePhabricator

depends: Add Android NDK support
AbandonedPublic

Authored by Fabien on Apr 3 2020, 14:32.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary
This allows one to build the dependencies with the Android SDK and goes
towards fixing #11844. It has been tested to work with:
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
NO_QT=1 NO_WALLET=1

Backport of core PR16110.

This allows for building the depends for android, and the software on
top. It's not very useful for now (no packaging) but it's a first step.

  • Note 1: The i686 build from the initial PR is broken with qt, fixed in this diff.
  • Note 2: I made the README a bit more easier to follow, since we have already taken ownership of the file.
  • Note 3: For now the cmake build is not successful. There are some Qt issues (can find the main module but not its components ?).
Test Plan

Tested on Debian 10:
Follow the doc instructions to install the android 9 platform and the
NDK, then:

cd depends
export ANDROID_SDK=$HOME/Android/Sdk
export ANDROID_NDK=${ANDROID_SDK}/ndk/21.0.6113669
export ANDROID_TOOLCHAIN_BIN=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin
export ANDROID_API_LEVEL=28
make build-android-aarch64

cd ..
./autogen.sh
mkdir buildAutotoolsAndroidAArch64
cd buildAutotoolsAndroidAArch64
make -j42

Also built the depends for all the other android architectures.

Example build with cmake (but no Qt, see summary):

cmake -GNinja .. \
  -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
  -DCMAKE_FIND_ROOT_PATH=${PWD}/../depends/aarch64-linux-android \
  -DANDROID_ABI=arm64-v8a \
  -DANDROID_NATIVE_API_LEVEL=${ANDROID_API_LEVEL}

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR16110
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 10121
Build 18070: Default Diff Build & Tests
Build 18069: arc lint + arc unit

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Fabien edited the test plan for this revision. (Show Details)
deadalnix requested changes to this revision.Apr 3 2020, 16:42
deadalnix added a subscriber: deadalnix.

Is there any plan to actually support this? Because in its urrent form, it's going to be broken by next week and the main effect will be to have slowed down the depends bid and added a ton of dependencies (in fact, if I arc patch this, depends build fail for me and I have no idea why, probably because I'm missing something needed for android?).

This revision now requires changes to proceed.Apr 3 2020, 16:42

You need the NDK for the build to succeed (see the README).

Clearly I have no short term plan for this. As is it doesn't do much, since the UI isn't really adapted to mobile and there is no APK packaging yet to make it easy to install and run.

On the other hand I have a few backports that depends on it, and there is a small team actively working on this for core.
It will allow to not rewind the git history for missed parts if we want to add android later, and make it easier to stay in sync with the depends.

I initially planned to skip it (this is why is comes late in my stack), but finally decided to pull it mostly for having the other dependencies with it.

I leave that up to you since I don't have a strong opinion, and clearly no use case for it at the moment.