Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-23043

Automatic type dump of QML module failed with external dependencies

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 4.10.0
    • Quick / QML Support
    • None
    • Windows

    Description

      Consider such files tree structure:

      bin
       |- app.exe
       |- foo.dll
       |- qml
         |- Bar
           |- plugin.dll // link against foo.dll
           |- qmldir

      It's exactly the same how qtquickcontrols2plugin.dll link against Qt5QuickControls2.dll. I can use qmlplugindumpexe command tool and modify %PATH% in a console to generate .qmltypes file. But when I write QML codes in such a project with Qt Creator, I got

      Automatic type dump of QML module failed.
      Errors:
      "Qt\5.13.1\msvc2019_64\bin\qmlplugindump.exe" returned exit code 3.
      Arguments: -nonrelocatable Bar 1.0 .
      QQmlComponent: Component is not ready
      bin/qml/Bar/qmldir: plugin cannot be loaded for module "": Cannot load library bin\qml\Bar\plugin.dll: The specified module could not be found.
      

      and of course no highlights and auto completion for the components in Bar module.

      And I tried to modify PATH variable in 'Build/Run Environment' but with no luck.

      I also looked into src/libs/qmljs/qmljsplugindumper.cpp

      void PluginDumper::runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &info,
          const QStringList &arguments, const QString &importPath)
      {
          QDir wd = QDir(importPath);
          wd.cdUp();
          QProcess *process = new QProcess(this);
          process->setEnvironment(info.qmlDumpEnvironment.toStringList());
          QString workingDir = wd.canonicalPath();
          process->setWorkingDirectory(workingDir);
          connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
                  this, &PluginDumper::qmlPluginTypeDumpDone);
          connect(process, &QProcess::errorOccurred, this, &PluginDumper::qmlPluginTypeDumpError);
          process->start(info.qmlDumpPath, arguments);
          m_runningQmldumps.insert(process, importPath);
      }
      

      and src/plugins/qmljstools/qmljsmodelmanager.cpp

      ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
              Project *project) const
      {
          ...
          ModelManagerInterface::ProjectInfo projectInfo(project);
          projectInfo.qmlDumpEnvironment = Utils::Environment::systemEnvironment();
          ...
      }
      

      It seems that the dumper prefer a system environment than build or run environments in IDE so that I have to add the bin path to global system environment to make Qt Creator works correctly.

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              gpbeta Joshua GPBeta
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes