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

Applications only linking against static Qt Qml backing targets don't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 6.2.0 Alpha
    • None
    • macOS

    Description

      1) Cherry-pick https://codereview.qt-project.org/c/qt/qtdeclarative/+/346273 to qtdeclarative
      2) Configure qtbase and qtdeclarative with -static or -DBUILD_SHARED_LIBS=OFF and build them
      3) export QML_IMPORT_TRACE=1
      4) Try to run qtbase/bin/qmleasing
      5) Observe that app launches but qml is not initialized

      QQmlImportDatabase::addImportPath: "/Volumes/T3/Dev/qt/qt5_cmake/builds/dev-mac-static/qtbase/qml"
      QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
      QQmlImportDatabase::addImportPath: "/Volumes/T3/Dev/qt/qt5_cmake/builds/dev-mac-static/qtbase/bin"
      QQmlImports(qrc:/preview.qml)::addLibraryImport: "QtQuick" 2.0 as ""
      QQmlImports(qrc:/preview.qml)::importExtension: loaded ":/qt-project.org/imports/QtQuick/qmldir"
      QQmlImportDatabase::resolvePlugin: Could not resolve plugin "qtquick2plugin" in ":/qt-project.org/imports/QtQuick"
      qrc:/preview.qml:29:1: module "QtQuick" plugin "qtquick2plugin" not found
           import QtQuick 2.0
      

      Note that qmleasing target links directly to Qt::Qml and Qt::Quick, but does not run qmlimportscanner, does not have Q_IMPORT_PLUGIN(Quick) calls, and does not link against the optional plugins.

      Here's the relevant part of the link line to confirm that the libs are linked and the resources with the qmldir are linked.

      /Volumes/T3/Dev/qt/qt5_cmake/builds/dev-mac-static/qtbase/lib/libQt6Quick_debug.a
      src/qml/CMakeFiles/Qml_resources_1.dir/.rcc/qrc_qmake_QtQml.cpp.o
      src/quick/CMakeFiles/Quick_resources_1.dir/.rcc/qrc_qmake_QtQuick.cpp.o
      src/quick/CMakeFiles/Quick_resources_2.dir/.rcc/qrc_scenegraph_shaders.cpp.o
      

      generated qmldir contents

      module QtQuick
      optional plugin qtquick2plugin
      designersupported
      classname QtQuick2Plugin
      typeinfo plugins.qmltypes
      import QtQml auto
      prefer :/qt-project.org/imports/QtQuick/
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes