Bug 431031 - Cannot build for Android
Summary: Cannot build for Android
Status: RESOLVED DUPLICATE of bug 434875
Alias: None
Product: kirigami gallery
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-01 13:36 UTC by wincak
Modified: 2022-07-12 19:07 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Build log (4.64 KB, text/plain)
2021-01-01 13:36 UTC, wincak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wincak 2021-01-01 13:36:05 UTC
Created attachment 134436 [details]
Build log

I'm struggling to build kirigami-gallery for Android. Desktop build works fine, but Android build ends with error:

=====
CMake Error at src/CMakeLists.txt:52 (find_package):
  By not providing "FindKF5Kirigami2.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "KF5Kirigami2", but CMake did not find one.

  Could not find a package configuration file provided by "KF5Kirigami2" with
  any of the following names:

    KF5Kirigami2Config.cmake
    kf5kirigami2-config.cmake

  Add the installation prefix of "KF5Kirigami2" to CMAKE_PREFIX_PATH or set
  "KF5Kirigami2_DIR" to a directory containing one of the above files.  If
  "KF5Kirigami2" provides a separate development package or SDK, be sure it
  has been installed.
=====

Yes, kirigami2-dev package is installed and the "missing" file is in
/usr/lib/x86_64-linux-gnu/cmake/KF5Kirigami2/KF5Kirigami2Config.cmake
Setting KF5Kirigami2_DIR env variable or appending CMAKE_PREFIX_PATH doesn't seem to work. Sorry if this is a trivial CMake issue, I've been using qmake so far.

I already had to work around bug https://bugs.kde.org/show_bug.cgi?id=430952
by commenting out both lines mentioning "NATURAL" in /usr/share/ECM/toolchain/Android.cmake

I'm using Qt 5.15.1 installed in /home/wincak/Qt-toolkit by Qt maintenance tool. Android SDK+NDK are in /home/wincak/Android (Installed automatically by QtCreator. Building non-kirigami Qt applications for Android in QtCreator works)
Building in terminal by following the commands from project's README:

=====
export ANDROID_NDK=/home/wincak/Android/Qt/android-sdk-tools/ndk/21.3.6528147
export ANDROID_SDK_ROOT=/home/wincak/Android/Qt/android-sdk-tools
export Qt5_android=/home/wincak/Qt-toolkit/5.15.1/android
export PATH=$ANDROID_SDK_ROOT/platform-tools/:$PATH
# adapt the following path to your ant installation
export ANT=/usr/bin/ant
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

mkdir build
cd build

cmake .. \
    -DQTANDROID_EXPORTED_TARGET=kirigami2gallery \
    -DANDROID_APK_DIR=./src/ \
    -DECM_DIR=/usr/share/ECM/cmake \
    -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
    -DECM_ADDITIONAL_FIND_ROOT_PATH=/home/wincak/Qt-toolkit/5.15.1/android \
    -DCMAKE_PREFIX_PATH=/home/wincak/Qt-toolkit/5.15.1/android/lib/cmake/Qt5Core \
    -DANDROID_NDK=/home/wincak/Android/Qt/android-sdk-tools/ndk/21.3.6528147 \
    -DANDROID_SDK_ROOT=/home/wincak/Android/Qt/android-sdk-tools \
    -DANDROID_SDK_BUILD_TOOLS_REVISION=26.0.2 \
    -DCMAKE_INSTALL_PREFIX=/home/wincak/pokus/kirigami-gallery-install
=====

Kirigami guys, could you set up a CI that would build at least a minimal example on Ubuntu/Neon for Android, where could we noobs see all the necessary build steps? Build logs on binary-factory.kde.org give only hints, not the whole thing.

Operating System: KDE neon 5.20
KDE Plasma Version: 5.20.4
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2
Kernel Version: 5.4.0-58-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i7-3520M CPU @ 2.90GHz
Memory: 7,5 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000
Comment 1 Ludovic Jozeau 2021-04-03 14:36:24 UTC
Have you tried to compile kirigami with android toolchain?
I have all my android libs installed at the same place under /opt/android-libs/aarch64 and here is all I have installed:
android-aarch64-giflib
android-aarch64-ki18n
android-aarch64-kirigami2
android-aarch64-kitemmodels
android-aarch64-lcms2
android-aarch64-libintl-lite-git
android-aarch64-libjpeg-turbo
android-aarch64-libpng
android-aarch64-libtiff
android-aarch64-libwebp
android-aarch64-openjpeg2
android-aarch64-openssl
android-aarch64-qt5
android-aarch64-xz
android-aarch64-zlib

A good place to find instructions on how to build kirigami with android toolchain is the PKGBUILD for it: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=android-aarch64-kirigami2
Comment 2 Nate Graham 2022-07-12 19:07:56 UTC
*** This bug has been marked as a duplicate of bug 434875 ***