PDA

View Full Version : Completed my first app and want to deploy



GeneCode
14th September 2017, 02:37
I find it weird why Qt don't have a simple "Deploy" button to build a distributable build.
Instead I read around it seems there need to use command line and copying files and folders
here and there.

But most the notes I read I can't make sense of. Anybody have a real noob step by step tutorial
for this?

ado130
14th September 2017, 05:14
You didn't write your OS, but generalyhttp://wiki.qt.io/Building_Qt_Installers. For Windows I suggest to use InnoSetup. Yes, you have to copy there a few dll files. You can use http://www.dependencywalker.com/ to check which dll's are important.
I found this tutorial, you can try it as well - http://doc.qt.io/qt-5/windows-deployment.html#the-windows-deployment-tool - your_qt_installpath/version/compiler/bin/windeployqt.exe YourApplication.exe.

PierreA
17th September 2017, 23:57
Before releasing a program, you should make sure that it works on several different operating systems. Then you make a source tarball. I use CMake, so I use CPack to make the source tarball; if you use qmake, I'll let someone else explain that. Once you have the source tarball, publish it so that others can compile and run it.

GeneCode
18th September 2017, 02:41
Anyways.

I managed to solve it by asking in StackOverflow. Here is the details:

1. at the left panel of Qt Creator IDE, there is a "appname Debug" icon with small arrow on it. click that and change to "Release".
2. Then click Run. This will build the exe in "release" folder and run it.
3. Goto release folder (for example: G:\QT\build-AppName-Desktop_Qt_5_9_1_MinGW_32bit-Release\release)
and you will find AppName.exe there.
4. To deploy you must use this exe (and not the exe in the debug folder).
5. To deploy, you must goto DOS prompt, traverse to this release folder and type


C:\Qt\5.9.1\mingw53_32\bin\windeployqt.exe AppName.exe

Note: C:\Qt is where you install your Qt SDK.

You need to specify the full path of windeployqt.exe because the PATH is not included
in DOS. Or you can modify your dos path to include it so it would be easier to run this command.

6. Then you will see it will create additional files in that folder.
7. For Qt5.9 that I use, I also needed to copy additional dll files to this folder to make it able to run.
Goto C:\Qt\5.9.1\mingw53_32\bin and copy these 3 dll to your release folder:
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll

Then your exe should be able to run without Qt and you can pack the files for distribution.
(Test by close Qt Creator and double click the exe).

That's it. Thankyou.