Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85399

Android build system application support is broken

    XMLWordPrintable

Details

    Description

      There's a bunch of things currently broken with Qt6 CMake Android support.

      1) Configuring an example (rasterwindow) with CMake fails in add_qt_gui_executable
      because it can't find QtPlatformAndroid.cmake. It appears that the file is only used by internal qtbase (and other repos) builds, but it's not used in the public api.

      Even if it's included in Qt6Config.cmake, several other things inside it are broken.

      2) QtPlatformAndroid.cmake has a bunch of hardcoded NDK linux paths, which won't work on other OSes

       set(android_ndk_stdlib_base_path
              "${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/"
          )
      

      If I configure qtbase with BUILD_EXAMPLES on, and then try to run ninja rasterwindow_make_apk on macOS I get the following errors

      examples/gui/rasterwindow/CMakeFiles/rasterwindow_make_apk
      cd /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer_android/examples/gui/rasterwindow && /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer/bin/androiddeployqt --input /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer_android/examples/gui/rasterwindow/android-librasterwindow.so-deployment-settings.json --output /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer_android/examples/gui/rasterwindow/android-build
      Generating Android Package
        Input file: /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer_android/examples/gui/rasterwindow/android-librasterwindow.so-deployment-settings.json
        Output directory: /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer_android/examples/gui/rasterwindow/android-build/
        Application binary: rasterwindow
        Android build platform: android-29
        Install to device: No
      qmlimportscanner not found: /Volumes/T3/Dev/qt/qt5_cmake/qtbase_built_developer/bin/qmlimportscanner
      STL library does not exist at /Volumes/T3/Dev/android/sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib//i686-linux-android/libc++_shared.so
      ninja: build stopped: subcommand failed.
      

      Note the hardcoded linux libc++ path, as well as

      3) This piece of code in qt_android_generate_deployment_settings can't possibly work

      # Host Qt Android  install path
          if (NOT QT_BUILDING_QT)
              set(file_check "${Qt6_DIR}/plugins/platforms/android/libqtforandroid_${CMAKE_ANDROID_ARCH_ABI}.so")
      

      Qt6_DIR points to the cmake Config path, and not the prefix.

      4) Trying to build the same example with qmake fails with

      
      $ ../bin/qmake ../../qtbase/examples/gui/rasterwindow
      
      /Volumes/T3/Dev/qt/qt5_cmake/qtbase/mkspecs/features/exclusive_builds.prf:3: 
      Info: creating stash file /Volumes/T3/Dev/qt/.qmake.stash
      Conditional must expand to exactly one word.
      Project ERROR: Could not find feature static.
      

      5) Currently building Android on macOS fails due to some QPair shenanigans as reported in QTBUG-84924

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-85399
          # Subject Branch Project Status CR V

          Activity

            People

              alexandru.croitor Alexandru Croitor
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes