2

Im trying to deploy a set of QT applications. On linux all applications works fine after installing all dependencies, but in windows QtQuick based applications doesn't work at all.

To deploy on windows I follow this steps:

  1. Compile my project in release mode.
  2. Add mingw to the system environment path
  3. Run windeployqt.exe --release c:\myappdir\relesase\myapp.exe

When step 3 is finish I got a lot of dlls in the release folder Qt5Quick.dll among them. But myapp.exe doesn't work and didn't threw any error. In order to get any extra information I add console to my CONFIG parameter under myapp.pro file and running myapp.exe by console I got this info:

QQmlApplicationEngine failed to load component
qrc:/main.qml:1 module "QtQuick" is not installed
qrc:/main.qml:-1 module "QtQuick" is not installed
qrc:/main.qml:1 module "QtQuick" is not installed

My version of QtSDK is 5.10.0 with MinGW so this solution doesn't work at all, I got more errors.

More over if I try to run myapp.exe without those dll in the root folder it works fine.

I been the whole day trying to find any solutions but nothing seems to work.

I'm pretty sure I missing something but I don't know whats is it. Thanks

Engel
  • 189
  • 3
  • 16
  • 1
    Did you try with passing --qmldir? – Frank Osterfeld Nov 05 '18 at 22:07
  • You are not missing a DLL, but QML files. Check if you have the `qml` folder in your deployed directory and check the contents. Seems they weren't deployed correctly. You can try using the `--qmldir` option. – Felix Nov 05 '18 at 23:50

1 Answers1

6

As I suppose, I was missing something. --qmldir option is needed in order to add QtQuick modules.

windeployqt.exe --qmldir . --release c:\myappdir\relesase\myapp.exe

That line did the trick,

Thanks @frank osterfeld and @Felix

Engel
  • 189
  • 3
  • 16
  • 1
    Or if set as a custom build step, set: `--qmldir "%{CurrentProject:Path}" --release "%{CurrentBuild:Type}\%{CurrentProject:Name}.exe"` – Itay Grudev Dec 27 '21 at 12:31
  • Or in newer versions of Qt Creator: `--qmldir "%{CurrentProject:Path}" --%{ActiveProject:BuildConfig:Type} "%{ActiveProject:BuildConfig:Type}\%{CurrentProject:Name}.exe"` – Itay Grudev Jan 02 '22 at 03:42