D
D
Demetrio952014-08-08 21:08:29
Qt
Demetrio95, 2014-08-08 21:08:29

How to deploy (deployment) Qt application on windows?

Hello, with your permission - I will come from afar. Thank you.
I wrote to myself, which means the application, not knowing the troubles, until I thought about deployment.
I myself use linux, but in parallel, while I was writing, the application was tested by a friend on my windows, he also has QtCreator + Qt 5.3.1 Libraries + MinGW installed.
Gathered. Compiled on Release. Somehow they picked up the dependencies, Dependency Walker - turned out to be too complicated, so they picked it up by typing (on the file :) ), until the application began to ask for the qt platform plugin. I googled this article on Habré . I did the same as the author of the article. This error started popping up:
Ya_qDqCub5A.jpg
Having freaked out, a friend threw all the libraries that he found into the folder with the exe file, the application worked, but they were not happy for long, they began to delete libraries from the folder, thereby looking for the one from which it "suddenly" worked, as a result, exactly those remained in the folder the same files as before, but the application continued to work - magic! :D
Threw off a friend, of course, the same mistake as before.
Empirically, we found out that the error pops up at the QApplication initialization stage.
Source is here .

List of libraries that we have selected:
  • qwindows - platform plugin
  • qsqlite - sqlplugin
  • icudt52
  • icuin52
  • icuuc52
  • libgcc_s_dw2-1
  • libstdc++-6
  • libwinpthread-1
  • Qt5Core
  • Qt5Gui
  • Qt5Sql
  • Qt5Widgets
  • Qt5Xml

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EXL, 2014-08-09
@Demetrio95

You are deploying plugins incorrectly, they should be located in the program directory in subdirectories.
The structure of a project that will run on other computers should be like this:

Current Directory/
  |
  +-platforms/
  |	|
  |	+-qwindows.dll
  |
  +-sqldrivers/
  |	|
  |	+-qsqlite.dll
  |
  +-DatabaseAnime.exe
  |
  +-Qt5Core.dll
  |
  +-Qt5Gui.dll
  |
  +-Qt5Sql.dll
  |
  +-Qt5Widgets.dll
  |
  +-icudt52.dll
  |
  +-icuin52.dll
  |
  +-icuuc52.dll
  |
  +-libgcc_s_dw2-1.dll
  |
  +-libstdc++-6.dll
  |
  +-libwinpthread-1.dll

And a few more tips.
1. If your project does not use QtWebkit, you can rebuild the Qt 5.3.1 library, without the icu library, then your application will "slim" by 27 MB.
2. Again, if you are not using QtWebkit, you can build Qt 5.3.1 statically, getting a single executable file without any external DLLs and plugins, which can be compressed with upx 'om and get an exe file of acceptable sizes (~3- 5MB).
You can read more about deployment in the official documentation .

S
Sergey Savostin, 2014-08-08
@savostin

Don't take this as an answer, because just found it myself:
https://github.com/WPN-XM/qt-mini-deploy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question