Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1840

qmltyperegistrar emits missing type warnings due to incorrect --foreign-types resolution in QBS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 3.0.0
    • 2.4.1
    • General
    • None
    • 43cf1fe91 (3.0)

    Description

      When compiling a library with Qt.qml.importName set (which triggers qmltyperegistrar), I receive multiple warnings from the tool about missing Qt types. A typical warning looks like:

      "QObject is used as base type but cannot be found."

      This appears to be caused by qmltyperegistrar not being passed the correct --foreign-types arguments. From what I can tell, QBS attempts to resolve the metatypes JSON file in the following way (see share/qbs/module-providers/Qt/setup-qt.js):

      var metaTypesFile = qtProps.libraryPath + "/metatypes/qt" + qtProps.qtMajorVersion + module.qbsName + "_metatypes.json";

      However, in my setup (installed via the Qt Maintenance Tool), the installed file has a different name:
       

      6.5.6/gcc_64/metatypes/qt6core_relwithdebinfo_metatypes.json

      Notice the relwithdebinfo infix, which causes the file to be missed during resolution. As a result, the qmltyperegistrar does not receive the necessary type information, leading to these warnings.

      This workaround fixes the issue for me:

      readonly property string _qtCoreMetatypesPath: Qt.core.installPrefixPath + "/metatypes/qt"
          + Qt.core.versionMajor + "core_relwithdebinfo_metatypes.json"
      Qt.qml.extraMetaTypesFiles: File.exists(_qtCoreMetatypesPath) ? [ _qtCoreMetatypesPath ] : []

       

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            jsilberbauer_syk Johannes Silberbauer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes