scripts and changes to setup krita for android devices
Details
- Reviewers
vkrause apol - Group Reviewers
Krita - Commits
- R37:096ca427464c: [Android]: Changes to access default resources and plugins
R37:60927ab6950f: Setup for android(arm) build
R37:e7cd01367a82: Minor bug fix
R37:75176033663f: Setup for android(arm) build
R37:c738c293f4bc: Patches removed by including the API flag in `build_kf5.sh`
R37:d6a19ad75237: Setup for android(arm) build
R37:4db60b31452b: Changed Q_OS_ANDROID to HAS_ONLY_OPENGL_ES
R37:a2f4b6c2a0a9: Fix change which broke desktop builts
Diff Detail
- Repository
- R37 Krita
- Branch
- android-build
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 10255 Build 10273: arc lint + arc unit
3rdparty/ext_expat/CMakeLists.txt | ||
---|---|---|
4 | Maintainability-wise, having the same thing twice isn't very practical. Maybe you can just pass to this one some android extra arguments? | |
libs/ui/opengl/kis_opengl_canvas2.cpp | ||
419 | I think it would make sense to have a HAVE_OPENGL, it reads random not wanting to do that on a specific platform. (for this one and similar cases). | |
packaging/android/build_kf5.sh | ||
34 | Please use the tooling in the Android SDK. you can build Krita and its dependencies by running: |
> CMakeLists.txt:4
> if (WIN32)
> ExternalProject_Add( ext_expat
> DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}Maintainability-wise, having the same thing twice isn't very practical. Maybe you can just pass to this one some android extra arguments?
This is how krita handles its external dependencies mostly, so I'm not to worried about it, we have separate definitions for macOS, Windows and Linux all over the place.
Having the Qt installer, frameworks done with kdesrc-build and the rest with the usual 3rdparty extra cmake projects is a bit weird, and I would prefer to have everything done with the 3rdparty/ext_* things. But first I want to get this patch working. kdesrc-build seems to fail for me...
Notes:
- Qt: download qt-unified-linux-x64-3.0.6-online.run from qt.io.
- Android NDK: https://developer.android.com/ndk/downloads/older_releases.html, 18 was used
- Android SDK: https://developer.android.com/studio -- scroll down for the commandline tools
My setttings:
export BASE=/home/boud/dev/android
export KRITA_ROOT=$BASE/krita
export CMAKE_ANDROID_NDK=$BASE/android-ndk-r19b
export ANDROID_NDK_ROOT=$BASE/android-ndk-r19b
export ANDROID_SDK_ROOT=$BASE/tools
export ANDROID_API_LEVEL=21
export QT_ANDROID=$BASE/Qt/5.12.1/android_armv7/
kdesrc-build builds inside krita's repo -- that's perhaps not ideal.
I do not have a succesful build:
boud@boud-ThinkPad-T470p:~/dev/android$ ./krita/packaging/android/build_kf5.sh
./krita/packaging/android/build_kf5.sh: line 20: cd: ./krita/packaging/android: No such file or directory
Cloning into 'kdesrc-conf-android'...
remote: Counting objects: 42, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 42 (delta 13), reused 33 (delta 10)
Receiving objects: 100% (42/42), 4.83 KiB | 2.42 MiB/s, done.
Resolving deltas: 100% (13/13), done.
Cloning into 'extragear/kdesrc-build'...
remote: Counting objects: 8911, done.
remote: Compressing objects: 100% (3912/3912), done.
remote: Total 8911 (delta 5643), reused 7145 (delta 4527)
Receiving objects: 100% (8911/8911), 3.09 MiB | 6.07 MiB/s, done.
Resolving deltas: 100% (5643/5643), done.
Cloning kde-build-metadata
Cloning sysadmin-repo-metadata
Building extra-cmake-modules from guessed_from_cmdline (1/1)
Cloning extra-cmake-modules Source update complete for extra-cmake-modules: 519 files affected. Preparing build system for extra-cmake-modules. Running cmake... Compiling... succeeded (after 3 seconds) Installing.. succeeded (after 0 seconds)
<<< PACKAGES SUCCESSFULLY BUILT >>>
extra-cmake-modules
- Installing "sample-kde-env-master.sh" would overwrite an existing file:
- /home/boud/.config/kde-env-master.sh
- If this is acceptable, please delete the existing file and re-run,
- or pass --delete-my-settings and re-run.
:-)
Your logs are saved in /home/boud/dev/android/krita//kf5/kde/src/log/2019-03-13-01
Updating kde-build-metadata (to branch master)
Updating sysadmin-repo-metadata (to branch master)
Building libintl-lite (1/4)
Cloning libintl-lite Source update complete for libintl-lite: 9 files affected. Preparing build system for libintl-lite. Running cmake... Unable to configure libintl-lite with CMake! Unable to configure libintl-lite with KDE
Building ki18n from frameworks-android (2/4)
Cloning ki18n Source update complete for ki18n: 61 files affected. Preparing build system for ki18n. Running cmake... Unable to configure ki18n with CMake! Unable to configure ki18n with KDE
Building kcoreaddons from guessed_from_cmdline (3/4)
Cloning kcoreaddons Source update complete for kcoreaddons: 183 files affected. Preparing build system for kcoreaddons. Running cmake... Unable to configure kcoreaddons with CMake! Unable to configure kcoreaddons with KDE
Building kcompletion from guessed_from_cmdline (4/4)
Cloning kcompletion Source update complete for kcompletion: 48 files affected. Preparing build system for kcompletion. Running cmake... Unable to configure kcompletion with CMake! Unable to configure kcompletion with KDE
<<< PACKAGES FAILED TO BUILD >>>
libintl-lite - ~/dev/android/kritakf5/kde/src/log/2019-03-13-02/libintl-lite/cmake.log
ki18n - ~/dev/android/kritakf5/kde/src/log/2019-03-13-02/ki18n/cmake.log
kcoreaddons - ~/dev/android/kritakf5/kde/src/log/2019-03-13-02/kcoreaddons/cmake.log
kcompletion - ~/dev/android/kritakf5/kde/src/log/2019-03-13-02/kcompletion/cmake.log
- Installing "sample-kde-env-master.sh" would overwrite an existing file:
- /home/boud/.config/kde-env-master.sh
- If this is acceptable, please delete the existing file and re-run,
- or pass --delete-my-settings and re-run.
:-(
Your logs are saved in /home/boud/dev/android/kritakf5/kde/src/log/2019-03-13-02
sed: can't read /home/boud/dev/android/kritakf5/kde/src/frameworks/kitemmodels/CMakeLists.txt: No such file or directory
sed: can't read /home/boud/dev/android/krita//kf5/kde/src/frameworks/kitemmodels/CMakeLists.txt: No such file or directory
Updating kde-build-metadata (to branch master)
Updating sysadmin-repo-metadata (to branch master)
Building kcoreaddons from guessed_from_cmdline (1/9)
No source update, but the last configure failed Updating kcoreaddons (to branch master) Local changes detected, stashing them away... Module updated, reapplying your local changes. Source update complete for kcoreaddons: no files affected Preparing build system for kcoreaddons. Removing files in build directory for kcoreaddons Old build system cleaned, starting new build system. Running cmake... Unable to configure kcoreaddons with CMake! Unable to configure kcoreaddons with KDE
Building kconfig from frameworks-android (2/9)
Cloning kconfig Source update complete for kconfig: 231 files affected. Preparing build system for kconfig. Running cmake... Unable to configure kconfig with CMake! Unable to configure kconfig with KDE
Building ki18n from frameworks-android (3/9)
No source update, but the last configure failed Updating ki18n (to branch master) Local changes detected, stashing them away... Module updated, reapplying your local changes. Source update complete for ki18n: no files affected Preparing build system for ki18n. Removing files in build directory for ki18n Old build system cleaned, starting new build system. Running cmake... Unable to configure ki18n with CMake! Unable to configure ki18n with KDE
Building kwidgetsaddons from guessed_from_cmdline (4/9)
Cloning kwidgetsaddons Source update complete for kwidgetsaddons: 296 files affected. Preparing build system for kwidgetsaddons. Running cmake... Unable to configure kwidgetsaddons with CMake! Unable to configure kwidgetsaddons with KDE
Building kcompletion from guessed_from_cmdline (5/9)
No source update, but the last configure failed Updating kcompletion (to branch master) Local changes detected, stashing them away... Module updated, reapplying your local changes. Source update complete for kcompletion: no files affected Preparing build system for kcompletion. Removing files in build directory for kcompletion Old build system cleaned, starting new build system. Running cmake... Unable to configure kcompletion with CMake! Unable to configure kcompletion with KDE
Building kguiaddons from guessed_from_cmdline (6/9)
Cloning kguiaddons Source update complete for kguiaddons: 47 files affected. Preparing build system for kguiaddons. Running cmake... Unable to configure kguiaddons with CMake! Unable to configure kguiaddons with KDE
Building kitemmodels from guessed_from_cmdline (7/9)
Cloning kitemmodels Source update complete for kitemmodels: 151 files affected. Preparing build system for kitemmodels. Running cmake... Unable to configure kitemmodels with CMake! Unable to configure kitemmodels with KDE
Building kitemviews from guessed_from_cmdline (8/9)
Cloning kitemviews Source update complete for kitemviews: 40 files affected. Preparing build system for kitemviews. Running cmake... Unable to configure kitemviews with CMake! Unable to configure kitemviews with KDE
Building kwindowsystem from guessed_from_cmdline (9/9)
Cloning kwindowsystem Source update complete for kwindowsystem: 110 files affected. Preparing build system for kwindowsystem. Running cmake... Unable to configure kwindowsystem with CMake! Unable to configure kwindowsystem with KDE
<<< PACKAGES FAILED TO BUILD >>>
kcoreaddons - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kcoreaddons/cmake.log
kconfig - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kconfig/cmake.log
ki18n - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/ki18n/cmake.log
kwidgetsaddons - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kwidgetsaddons/cmake.log
kcompletion - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kcompletion/cmake.log
kguiaddons - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kguiaddons/cmake.log
kitemmodels - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kitemmodels/cmake.log
kitemviews - ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kitemviews/cmake.log
kwindowsystem - ~/dev/android/krita//kf5/kde/src/log/2019-03-13-03/kwindowsystem/cmake.log
- Installing "sample-kde-env-master.sh" would overwrite an existing file:
- /home/boud/.config/kde-env-master.sh
- If this is acceptable, please delete the existing file and re-run,
- or pass --delete-my-settings and re-run.
:-(
Your logs are saved in /home/boud/dev/android/krita//kf5/kde/src/log/2019-03-13-03
sed: can't read kde/install/lib/cmake/KF5I18n/KF5I18nMacros.cmake: No such file or directory
cp: cannot stat '/usr/lib/x86_64-linux-gnu/libexec/kf5/kconfig_compiler_kf5': No such file or directory
Could you paste the log file ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kcoreaddons/cmake.log and ~/dev/android/kritakf5/kde/src/log/2019-03-13-03/kwidgetsaddons/cmake.log so I can get a general idea, why it is failing?
CMakeLists.txt | ||
---|---|---|
255 | Apparently there is, as no other application on binary factory seems to need this ;-) | |
packaging/android/build_kf5.sh | ||
34 | Yep, that would make setting up nightly builds on binary factory straightforward for this. | |
60 | These patches are somewhat surprising, as both the CI and binary factory manage to build this just fine without needing any of this. |
CMakeLists.txt | ||
---|---|---|
255 | I tried using it and other variables, but couldn't get cmake to find the packages. | |
packaging/android/build_kf5.sh | ||
34 | I did see the docker image. I couldn't pull the image because of some authorization issues. | |
60 | Yes! |
Sorry, missed your IRC message: Referring to the kcompletion linker error (https://paste.ubuntu.com/p/xr5MDGvf6h/): this again looks like an issue with the API level define not being propagated correctly. At API 23 stdout/stderr etc changed from a define to an actual symbol. If you don't see -DANDROID_API=xx in the compiler command lines something is probably still fundamentally wrong.
In CMakeCache.txt it is given out ANDROID_API_LEVEL:STRING=21. When I change it to 23, only then it builds fine.
However, in CI API 21 is being used.
I agree you should make a separate define for use with OpenGL-ES-only environments. OpenGL ES is not limited to Android after all.
Aside from the suggestion to use a more specific define, I see that you put #ifdef blocks inside the conditional blocks for the condition !KisOpenGL::hasOpenGLES(). This isn't great because:
- If you expect KisOpenGL::hasOpenGLES() to always return true, then there would be a pointless run-time conditional check.
- If there is a bug elsewhere (or missing checks) that causes KisOpenGL::hasOpenGLES() to return false, it ends up silently skipping some code instead of outputting an error or crashing immediately (though it will probably still crash eventually).
May I suggest you to either exclude the conditional checks with #ifdef or add asserts in the else blocks?
In hindsight, it might've been better to have put four classifications at compile time:
- Desktop OpenGL only (Linux and macOS)
- Desktop OpenGL or OpenGL ES (Windows with Qt ANGLE switching)
- OpenGL ES only (mobile, which wasn't supported before this change)
- No OpenGL (only software-rendered canvas, though I don't think Krita currently provides this option at compile time)
Btw it is actually possible to use OpenGL ES on some desktop OpenGL environments without using ANGLE,. It's just that Krita doesn't try to use them.
But if you're targeting an OpenGL ES environment, you would exclude everything that targets desktop OpenGL because they wouldn't even compile.
libs/ui/opengl/kis_opengl_canvas2.cpp | ||
---|---|---|
419 | I would suggest to use something like HAVE_OPENGL_ES_NO_DESKTOP_OPENGL, maybe in some alternative wording. It should deliver the meaning that OpenGL ES library is available but full desktop OpenGL is not. |
packaging/android/build_kf5.sh | ||
---|---|---|
60 | You were right, it was an issue with ANDROID_API. But oddly enough, __ANDROID_API__ was being added to c_flags but not to cxx_flags in CMakeCache.txt |