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

Building qtbase unit tests for Android fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.3.0 Alpha
    • 6.2.0 FF
    • Build System: CMake
    • None
    • Android
    • 00a5d9f84922e43a6242392de0270d7a77a04b58 (qt/qtbase/dev)

    Description

      building qtbase for host & android fails.

      I am using the following commands to build:

      basedir=`pwd`
      mkdir qtbase
      pushd qtbase
      /usr/bin/cmake  -DWARNINGS_ARE_ERRORS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/gcc-11 -DCMAKE_CXX_COMPILER=/usr/bin/g++-11 -G Ninja -DFEATURE_developer_build=ON -DCMAKE_CXX_FLAGS=-Wfatal-errors -DQT_BUILD_TESTS=ON -DQT_BUILD_EXAMPLES=OFF /home/andreasbuhr/development/qtdev/qtbase
      /usr/bin/cmake --build .
      popd
      
      mkdir qtbase-android
      pushd qtbase-android
      /usr/bin/cmake  -DWARNINGS_ARE_ERRORS=OFF -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_TOOLCHAIN_FILE=/home/andreasbuhr/Android/Sdk/ndk/21.3.6528147/build/cmake/android.toolchain.cmake -DANDROID_SDK_ROOT=/home/andreasbuhr/Android/Sdk -DQT_HOST_PATH=$basedir/qtbase -DFEATURE_developer_build=ON -DCMAKE_CXX_FLAGS=-Wfatal-errors -DQT_BUILD_TESTS=ON /home/andreasbuhr/development/qtdev/qtbase
      cmake --build .
      ninja tst_qmetatype_make_apk
      popd
      

      androiddeployqt fails, saying

      FAILED: tests/auto/corelib/kernel/qmetatype/android-build/tst_qmetatype.apk 
      cd /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype && /usr/bin/cmake -E copy /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/libtst_qmetatype_armeabi-v7a.so /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build/libs/armeabi-v7a/libtst_qmetatype_armeabi-v7a.so && /home/andreasbuhr/development/qtdev/androidbuild/qtbase/bin/androiddeployqt --input /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-tst_qmetatype-deployment-settings.json --output /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build --apk /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build/tst_qmetatype.apk
      Cannot find template directory /src/3rdparty/gradle
      Generating Android Package
        Input file: /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-tst_qmetatype-deployment-settings.json
        Output directory: /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build/
        Application binary: tst_qmetatype
        Android build platform: android-30
        Install to device: No
      ninja: build stopped: subcommand failed.
      ~/development/qtdev/androidbuild
      

      The reason for it not finding the gradle template directory is the empty install path in android-tst_qmetatype-deployment-settings.json. Its content is

      {
         "description": "This file is generated by cmake to be read by androiddeployqt and should not be modified by hand.",
         "qt": "",
         "sdk": "/home/andreasbuhr/Android/Sdk",
         "sdkBuildToolsRevision": "30.0.3",
         "ndk": "/home/andreasbuhr/Android/Sdk/ndk/21.3.6528147",
         "toolchain-prefix": "llvm",
         "tool-prefix": "llvm",
         "useLLVM": true,
         "toolchain-version": "clang",
         "ndk-host": "linux-x86_64",
         "architectures": { "armeabi-v7a" : "arm-linux-androideabi" },
         "qml-root-path": "/home/andreasbuhr/development/qtdev/qtbase/tests/auto/corelib/kernel/qmetatype",
         "application-binary": "tst_qmetatype",
         "qml-importscanner-binary" : "/home/andreasbuhr/development/qtdev/androidbuild/qtbase/./libexec/qmlimportscanner",
         "rcc-binary" : "/home/andreasbuhr/development/qtdev/androidbuild/qtbase/./libexec/rcc",
         "extraPrefixDirs" : [  ],
         "stdcpp-path": "/home/andreasbuhr/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/"
      }
      

      It can be fixed on my machine by applying https://codereview.qt-project.org/c/qt/qtbase/+/357477

      With this patch applied, androiddeployqt says

      Generating Android Package
        Input file: /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-tst_qmetatype-deployment-settings.json
        Output directory: /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build/
        Application binary: tst_qmetatype
        Android build platform: android-30
        Install to device: No
      Warning: no 'qml' directory found under Qt install directory or import paths. Skipping QML dependency scanning.
      Skipping createRCC
      > Task :preBuild UP-TO-DATE
      > Task :preDebugBuild UP-TO-DATE
      > Task :compileDebugAidl
      > Task :compileDebugRenderscript NO-SOURCE
      > Task :generateDebugBuildConfig
      > Task :javaPreCompileDebug
      > Task :checkDebugAarMetadata
      > Task :generateDebugResValues
      > Task :generateDebugResources
      > Task :createDebugCompatibleScreenManifests
      > Task :extractDeepLinksDebug
      > Task :mergeDebugResources
      > Task :processDebugMainManifest
      > Task :processDebugManifest
      > Task :mergeDebugNativeDebugMetadata NO-SOURCE
      > Task :mergeDebugShaders
      > Task :compileDebugShaders NO-SOURCE
      > Task :generateDebugAssets UP-TO-DATE
      > Task :mergeDebugAssets
      > Task :compressDebugAssets
      > Task :processDebugJavaRes NO-SOURCE
      > Task :checkDebugDuplicateClasses
      > Task :mergeDebugJavaResource
      > Task :mergeLibDexDebug
      > Task :desugarDebugFileDependencies
      > Task :mergeDebugJniLibFolders
      > Task :validateSigningDebug
      > Task :processDebugManifestForPackage
      > Task :mergeExtDexDebug
      > Task :processDebugResources
      
      > Task :compileDebugJavaWithJavac
      Note: Some input files use or override a deprecated API.
      Note: Recompile with -Xlint:deprecation for details.
      
      > Task :compileDebugSources
      > Task :dexBuilderDebug
      > Task :mergeProjectDexDebug
      > Task :mergeDebugNativeLibs
      
      > Task :stripDebugDebugSymbols
      WARNING: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [21.3.6528147] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir
      NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [21.3.6528147] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir
      
      > Task :packageDebug
      > Task :assembleDebug
      
      BUILD SUCCESSFUL in 3s
      28 actionable tasks: 28 executed
      Android package built successfully in 4,360 ms.
        -- File: /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build//build/outputs/apk/debug/android-build-debug.apk
      [2/2] cd /home/andreasbuhr/development/qtdev/androidbuild/qtbase-android/tests/auto/...d/qtbase-android/tests/auto/corelib/kernel/qmetatype/android-build/tst_qmetatype.apk
      

      and the content of android-tst_qmetatype-deployment-settings.json is

      {
         "description": "This file is generated by cmake to be read by androiddeployqt and should not be modified by hand.",
         "qt": "/home/andreasbuhr/development/qtdev/androidbuild/qtbase-android",
         "sdk": "/home/andreasbuhr/Android/Sdk",
         "sdkBuildToolsRevision": "30.0.3",
         "ndk": "/home/andreasbuhr/Android/Sdk/ndk/21.3.6528147",
         "toolchain-prefix": "llvm",
         "tool-prefix": "llvm",
         "useLLVM": true,
         "toolchain-version": "clang",
         "ndk-host": "linux-x86_64",
         "architectures": { "armeabi-v7a" : "arm-linux-androideabi" },
         "qml-root-path": "/home/andreasbuhr/development/qtdev/qtbase/tests/auto/corelib/kernel/qmetatype",
         "application-binary": "tst_qmetatype",
         "qml-importscanner-binary" : "/home/andreasbuhr/development/qtdev/androidbuild/qtbase/./libexec/qmlimportscanner",
         "rcc-binary" : "/home/andreasbuhr/development/qtdev/androidbuild/qtbase/./libexec/rcc",
         "extraPrefixDirs" : [  ],
         "stdcpp-path": "/home/andreasbuhr/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/"
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            andreasbuhr Andreas Buhr
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes