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

Windows deployment is still a huge buggy pain

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.4.2
    • None
    • Windows 7, Qt 5.4, Mingw
    • windeployqt warning when MinGW runtime not found 6e0cb96b10a6865a9f881cf0b1013cfa024fcd79 (qttools/5.5, 8.6.2015, 5.5.1)

      Windows deployment is a huge pain that isn't documented well and is full of gotchas. This is roughly the process you have to go through:

      1. Compile your app. It won't run when you double click the exe because it is missing loads of DLLs and QML files.

      2. Open a command line in the exe directory. Run the following command, giving it the path to your source directory and the exe path.

      C:\Qt\5.4\mingw491_32\bin\windeployqt --dir out --compiler-runtime --release --qmldir ../../path/to/MyProject MyProject.exe

      3. Copy the exe into the output directory.

      copy MyProject.exe out

      4. Observe that --compiler-runtime is totally broken so copy the runtime manually.

      copy C:\Qt\5.4\mingw491_32\bin\libgcc_s_dw2-1.dll out
      copy C:\Qt\5.4\mingw491_32\bin\libstdc++-6.dll out
      copy C:\Qt\5.4\mingw491_32\bin\libwinpthread-1.dll out

      5. Rename C:\Qt to C:\Qt2 so we can be sure when we run the program to test it it isn't picking up any system DLLs (the path to c:\Qt is encoded in the EXE).

      6. Run it, it should work.

      7. Upgrade your system install of Qt.

      8. Run the program again. It fails. WTF?! Well remember I said the path to c:\Qt is encoded in the exe? Apparently the system Qt install has a higher priority than looking in the local directory and if it is incompatible the app won't load it.

      9. The solution is to create a file called qt.conf with these contents:

      [Paths]
      Plugins=.

      10. Add it to your system with the alias "/qt/etc/qt.conf"

      11. Repeat all the above steps. It will now hopefully work even if there is an incompatible version of Qt in c:\Qt

      12. Try and run your program from Qt Creator. It doesn't work!! Because of the Plugins=. path it now no longer finds the Qt version in c:\Qt and won't run. ARGHGH!

      This is way too complicated, buggy and undocumented IMO.

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

            kleint Friedemann Kleint
            timmmm Tim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes