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

It is impossible to build tests with custom plugins in static build configurations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.4.0 FF
    • Build System: CMake
    • None

    Description

      I bumped into this problem in QtPositioning.

      QtPositioning completely relies on plugins, because they provide various positioning backends. The module is simply non-functional without them. For the purpose of testing the module has several test plugins that are located directly in the tests build tree.

      According to the documentation, for static builds we need to use

      • qt_import_plugins()
      • qt_import_qml_plugins()

      to explicitly specify that this application/test need to link to specific plugins.
      However using them reveals some problems.

      In-tree build

      For the in-tree build I used the following config:

      <path to qt5>/configure -debug -developer-build -static -nomake examples -submodules qtbase,qtdeclarative,qtserialport,qtpositioning -- -DQT_BUILD_TESTS_BY_DEFAULT=OFF
      

      it is documented that qt_import_qml_plugins() calls qmlimportscanner to determine which plugins we actually need to import and link. But in the in-tree build qmlimportscanner is not yet built by the time we want to use it. This results in the following error:

      CMake Error at qt6-build/static_build/qtbase/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:2492 (message):
      The package "QmlImportScanner" references the file
      
      "tool_path-NOTFOUND"
      
      but this file does not exist. Possible reasons include:
      
      * The file was deleted, renamed, or moved to another location.
      * An install or uninstall procedure did not complete successfully.
      * The installation package was faulty.
      
      Call Stack (most recent call first):
      qt6-build/static_build/qtbase/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:2638 (_qt_internal_scan_qml_imports)
      qt6-build/static_build/qtbase/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:2710 (qt6_import_qml_plugins)
      qtpositioning/tests/auto/declarative_positioning_core/CMakeLists.txt:44 (qt_import_qml_plugins)
      

      Out-of-tree build

      For out-of-tree build I used the following config:

      <path to qt5>/configure -debug -developer-build -static -nomake examples -nomake tests -submodules qtbase,qtdeclarative,qtserialport,qtpositioning
      

      and after that built the tests in a separate directory using

      <path to static built qtbase>/libexec/qt-internal-configure-tests /path/to/qtpositioning
      

      The issue here is that the plugins to be imported are taken from the installation dir, but the custom test plugins are simply not yet installed at the time of configuring. So we will never find and link them.

      So for now it looks like in the static configuration there is no way to build tests for the modules that use custom test-specific plugins.

      This problem currently affects at least QtPositioning and QtLocation.

      Attachments

        Issue Links

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

          Activity

            People

              qtbuildsystem Qt Build System Team
              ivan.solovev Ivan Solovev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes