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

RCC compression is broken when deploying to Android from a Linux host using CMake

    XMLWordPrintable

Details

    • Android, Linux/X11
    • 329dbfcc7 (dev), 2cf327be8 (6.7), 3738a2dc6 (6.6), aebb30748 (tqtc/lts-6.5), 736d6300b (6.6.2), b3cc89e81 (dev), b404d8e36 (6.7), a6c0f1703 (6.6), fc2404096 (tqtc/lts-6.5)

    Description

       

      Only listed 6.6.2, but this will affect other versions too.

      error: undefined symbol: qt_resourceFeatureZstd
      /home/qt/Downloads/build-qt-qrc-Android_Qt_6_6_2_Clang_x86_64-Debug/appqt-qrc_autogen/EWIEGA46WW/qrc_resources.cpp:60: referenced by qrc_resources.cpp:60 (appqt-qrc_autogen/EWIEGA46WW/qrc_resources.cpp:60)
      /home/qt/Downloads/build-qt-qrc-Android_Qt_6_6_2_Clang_x86_64-Debug/CMakeFiles/appqt-qrc.dir/appqt-qrc_autogen/EWIEGA46WW/qrc_resources.cpp.o:-1: CMakeFiles/appqt-qrc.dir/appqt-qrc_autogen/EWIEGA46WW/qrc_resources.cpp.o:(qResourceFeatureZstd())

      Attached is a minimal example that should fail when building for an Android target using Linux, and not fail when building for the host target. The only thing required appears to be enabling CMAKE_AUTORCC and having a .qrc file listed in qt_add_executable(). The problem is that rcc has been built with zstd compression enabled and as a result it's used at least when CMAKE_AUTORCC has been set (https://doc.qt.io/qt-6/rcc.html). But Android doesn't have this support, I think? Or our Android builds don't? This results in problems when building for Android.

      A little bit of COIN analysis follows.

      So this is our build for Qt 6.6.2: https://testresults.qt.io/coin/integration/qt/qt5/tasks/1706863868

      We can see in the qtbase->rhel-x.x builds

      -- Found WrapZSTD: /usr/lib64/libzstd.so (found suitable version "1.4.4", minimum required is "1.3") 

      ...and further calls with libztd references. This is because in provisioning the machine (70-install_dwz.sh) libzstd-devel gets installed:

       

       

      + sudo yum -y install elfutils-libelf-devel
      Updating Subscription Management repositories.
      Last metadata expiration check: 0:21:22 ago on Fri 26 Jan 2024 05:49:54 PM UTC.
      Package elfutils-libelf-devel-0.188-3.el8.x86_64 is already installed.
      Dependencies resolved.
      ======================================================================================
       Package                      Arch    Version     Repository                      Size
      ======================================================================================
      Upgrading:
       elfutils-debuginfod-client   x86_64  0.189-3.el8 rhel-8-for-x86_64-baseos-rpms   75 k
       elfutils-libelf              x86_64  0.189-3.el8 rhel-8-for-x86_64-baseos-rpms  232 k
       elfutils-libelf-devel        x86_64  0.189-3.el8 rhel-8-for-x86_64-baseos-rpms   62 k
       elfutils-libs                x86_64  0.189-3.el8 rhel-8-for-x86_64-baseos-rpms  303 k
      Installing dependencies:
       libzstd-devel                x86_64  1.4.4-1.el8 rhel-8-for-x86_64-baseos-rpms   44 k
      

      And now we have zstd enabled on the host side but not on the Android side, where:

       

       

      agent:2024/01/30 17:18:18 build.go:404: -- The following OPTIONAL packages have not been found:
      agent:2024/01/30 17:18:18 build.go:404:  * OpenSSL
      agent:2024/01/30 17:18:18 build.go:404:  * WrapOpenSSL
      agent:2024/01/30 17:18:18 build.go:404:  * zstd
      agent:2024/01/30 17:18:18 build.go:404:  * WrapZSTD (required version >= 1.3), ZSTD compression library, <https://github.com/facebook/zstd>
      

       

       

      This causes at least a regression compared to 6.6.1, where similar CMAKE_AUTORCC structures worked with Android. Here's the 6.6.1 build (I believe, it's tough to read these): https://testresults.qt.io/coin/integration/qt/qt5/tasks/1704486001

       

      agent:2023/11/17 05:28:18 build.go:404: -- The following OPTIONAL packages have not been found:
      agent:2023/11/17 05:28:18 build.go:404:  * zstd
      agent:2023/11/17 05:28:18 build.go:404:  * WrapZSTD (required version >= 1.3), ZSTD compression library, <https://github.com/facebook/zstd>
      

      and in provisioning:

       

       

      + sudo yum -y install elfutils-libelf-devel
      Updating Subscription Management repositories.
      Last metadata expiration check: 0:15:15 ago on Sat 11 Nov 2023 10:54:49 AM UTC.
      Package elfutils-libelf-devel-0.188-3.el8.x86_64 is already installed.
      Dependencies resolved.
      Nothing to do.
      Complete!
      

      And as a result, no libzstd-devel, no problems.

       

       

      So elfutils-libelf-devel has additional dependencies, which causes libzstd-devel to be installed, which causes zstd support to be built into rcc, which causes Android CMAKE_AUTORCC builds to fail. Or that's my theory. As for the solution, don't know. Prevent the installation for libzstd? Build without zstd support even if it exists? Don't allow CMAKE_AUTORCC with .qrc files? QTBUG-122577 had the same problem, I think, and in there they removed .qrc files from the project.

      Attachments

        Issue Links

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

          Activity

            People

              alexandru.croitor Alexandru Croitor
              olvuolte Olli Vuolteenaho
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: