Upgrade to ubuntu bionic and Qt 5.12

Authored by dfaure on May 14 2018, 7:13 AM.



Qt 5.6 is too old for KF5 these days.

Qt >= 5.9 no longer provides a binary installer for Android, so we're now compiling Qt ourselves (qtbase+qtdeclarative+qtlocation, for now).

Qt 5.12 requires the use of clang and a more recent NDK than 10e, so I upgraded to 15b (14b worked too).
Can't go up all the way to 18b because that requires a more recent cmake than the one in ubuntu bionic...

I reordered sections in the docker file mostly to skip doing the apt-get every time I change a Qt-related or NDK-related env var change, but also because unpacking the NDK now requires "unzip" so we need to install that first.

Using clang to compile KF5 seems optional, but if we want it for consistency, then this needs -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang in scratch/cordlandwehr/kdesrc-conf-android.git. I'm wondering why that is separate btw, the setup is related to this docker, so why don't we put the kdesrc-buildrc here and use Docker's COPY command?

Test Plan

The docker container gets built fine, all the way to KArchive.

KCoreAddons doesn't build though, for multiple reasons which seem more related to its code, to ECM, to kdesrc-conf-android.git... IOW nothing the dockerfile itself can fix, unless we realize we need a different NDK version after all.

Diff Detail

R38 Android Builder
No Linters Available
No Unit Test Coverage
Build Status
Buildable 6233
Build 6251: arc lint + arc unit
dfaure requested review of this revision.May 14 2018, 7:13 AM
dfaure created this revision.

Hmmpf by now Qt 5.8 is too old as well, and apparently there's no installer for Android anymore since Qt 5.9. I guess this means scrapping all that installer stuff and compiling Qt from sources instead....

I'm reworking the docker file.

But I'm curious, how does our CI work then? Apparently this docker is/was used by CI?

dfaure updated this revision to Diff 47906.Dec 20 2018, 7:16 PM

Full rework

dfaure retitled this revision from Upgrade to ubuntu bionic and Qt 5.8 to Upgrade to ubuntu bionic and Qt 5.12.Dec 20 2018, 7:18 PM
dfaure edited the summary of this revision. (Show Details)
dfaure edited the test plan for this revision. (Show Details)
dfaure added a reviewer: apol.
dfaure added a project: Android.
dfaure updated this revision to Diff 47923.Dec 20 2018, 11:39 PM

Upgrade to 15c to get a later version of clang 5.0

bcooksley added a subscriber: apol.Dec 21 2018, 3:06 AM

Adding Aleix, as I know he's worked on some Android stuff (I only vaguely recall this repository though).

It's been a long time since I built Qt, but this looks correct from what I understand of the process.

vatra added a subscriber: vatra.Dec 21 2018, 6:25 AM

I recommend you another approach:
Use sdkmanager (from Android SDK) to install Google's cmake. Personally I'm using it also to install the ndk, but NDKr18 removed the gcc support.
If you need also gcc the best NDK is r17c (has a non-buggy clang and gcc).

Hi Bogdan, thanks for the info.

"Use sdkmanager (from Android SDK) to install Google's cmake."

Any further hints on how to do that?

android-sdk-linux/tools/bin/sdkmanager cmake
Warning: File /home/kdeandroid/.android/repositories.cfg could not be loaded.
Error: Failed to find package cmake

Anyway, I guess cmake-3.10.2 is good enough for NDK 17c?

Hi Bogdan, thanks for the info.

"Use sdkmanager (from Android SDK) to install Google's cmake."

Any further hints on how to do that?

android-sdk-linux/tools/bin/sdkmanager cmake
Warning: File /home/kdeandroid/.android/repositories.cfg could not be loaded.
Error: Failed to find package cmake

You need to specify also the version:
android-sdk-linux/tools/bin/sdkmanager "cmake;3.6.4111459"
should work

yes, cmake cmake-3.10.2 should be ok with any NDK (including NDKr18)

apol added a comment.Dec 21 2018, 12:01 PM

Please use this one: https://phabricator.kde.org/source/sysadmin-ci-tooling/browse/master/system-images/android/sdk/Dockerfile

It's what serves this image: https://hub.docker.com/r/kdeorg/android-sdk

It has a cmake 3.12.4, Qt 5.11 and enough ECM stuff to get easily started.

There's also some tooling documented here: https://community.kde.org/Android/Environment_via_Container

I tried NDK r18 with cmake 3.10, and cmake is missing commit ca97d4cb5 (from cmake git) which adds support for r18 (starting from 3.12.2). Without that fix, cmake can't find the STL, iirc.

I'll use r17c.

There's still the issue that ANDROID_API_VERSION isn't defined when compiling C++ code (which breaks kcoreaddons because it uses getpwent), but that I can fix by defining it.
There's also the issue that ki18n says "error: undefined reference to 'stderr'" unless I set that API version to 24, so no more deploying on the old Android 4.4.2 tablet....
Other than that it works ;-)

dfaure updated this revision to Diff 47948.Dec 21 2018, 12:10 PM

Up to r17c, but now I'll try the CI's dockerfile...

dfaure updated this revision to Diff 47968.Dec 21 2018, 4:17 PM

factorize into build scripts, add qtquickcontrols, select the right version of the tools.

In D12864#380354, @apol wrote:

Thanks Aleix! I first tried the dockerfile but it takes forever to build and takes a lot of disk space.... however the tip about using kdeorg/android-sdk as basis worked great! I have switched to that now. Thanks for everything.

Andreas what shall we do about this repo? Replace its contents with a readme pointing to kdeorg/android-sdk, or do you still have a use for it?

@dfaure it's absolutely fine for me to dump this repository and reference kdeorg/android-sdk. The ci-tooling repository looks much more mature and we should not have two competing solutions for an infrastructure task (especially, since the ci-tooling one is actively used and maintained)

dfaure updated this revision to Diff 48026.Dec 22 2018, 8:02 PM
  • Delete everything in android-builder and point to kdeorg/android-sdk
cordlandwehr accepted this revision.Dec 22 2018, 8:03 PM
This revision is now accepted and ready to land.Dec 22 2018, 8:03 PM
dfaure closed this revision.Dec 22 2018, 11:01 PM