PDA

View Full Version : Has anybody ever able to deploy qt application?



Tarun
15th February 2010, 12:55
I am super frustrated, I am wondering, they have created such a beautiful devlopment plateform but why they are miser in providing easy deployment technique.

I have followed the tutorial http://doc.trolltech.com/4.1/deployment-windows.html , but always ends up with error 1 &error 2.
I have waisted 2 complete nights to deploy simple examples.
I reinstalled Qt 3-4 times because Qt creater get corrupted after every try of deployment.It does not even build eamples.
What is nmake, mingw32 make?

Why i am getting these error?

Please tell me some easy, solid way to successfully deploy qt example on windows.

Annihilator
15th February 2010, 13:05
What kind of errors do you have.

nish
15th February 2010, 13:09
as for your topic question.
Yes i have deployed many qt apps on win/mac/linux/winmobile/embeddedlinux/

now tell us what exactly the errors you are getting. ? and why are you reinstalling qt for deploying your application?
your post is not clear.

Tarun
15th February 2010, 14:09
1) I did

cd C:\path\to\Qt
configure -static <any other options you need>

it took 10 minutes
worked fine.

2)i did

nmake sub-src

nothing happened
then I did

mingw32-make

A process started and run for 4-5 hours.
I want to know why name did not work with me and why mingw32 worked?

It ended with error like exited error return 1 and exited error return 2.
(sorry i did not note the exact error messages. I will have to waist 4-5 hours to get that error again.

TheJim01
15th February 2010, 14:38
Mingw32 is an implementation of the GNU compiler for Windows environments: http://www.mingw.org/

Nmake is a Microsoft tool which allows you to build projects from a configuration file, much like the linux version of "make".

Personally, I prefer mingw32.

A really nice thing about the "make" process is, if you run mingw32-make again, it will skip everything that is already done, and re-attempt to compile the module that failed. The only time wasted will be waiting for that specific module, not all of them. So try running it again, and come back with the error.

Lykurg
15th February 2010, 14:42
1) I did

cd C:\path\to\Qt
configure -static <any other options you need>Why? Why you need static? I would suggest you first try to deploy your application with dynamic libraries!

ziXet
17th February 2010, 07:46
I have done last night!!

follow the instructions:
http://doc.trolltech.com/4.4/deployment-windows.html

but you MUST pick the DLL files (QtCore4.dll, QtGui4.dll , ...) from "Qt/2010.01/qt/bin"

dramsey
19th February 2010, 21:02
Well, I'm still having trouble. Why aren't deployment features built into the IDE?

Anyway, building statically ground to a stop on my Win 7 x64 system when I was informed that Qt couldn't determine the system I was on (fair enough, since Win 7 isn't a Tier 1 supported system yet), and I was instructed to use the "-platform" directive to specify this. Well, what to actually pass to this directive isn't listed anywhere as far as I can tell: the configure help file says to read the "Read me". The Read Me file refers to the Qt web page on supported platforms. Nowhere is there "and here's how you tell configure that you're building on a 64-bit Vista system".

OK, let's try dynamic-- it seems to be the preferred solution anyway. One little problem: the Qt 4.6 SDK/IDE apparently doesn't include the "nmake" tool (if it doesn, I can't find it).

So where do I go from here?

squidge
19th February 2010, 23:01
'nmake' is a Microsoft tool. I'm going to assume that Nokia don't have a license to include it with Qt, and since it comes with Visual Studio anyway, it would be daft if they did (after all, it requires Visual studio too)

For GCC, use MinGW Make instead.

dramsey
19th February 2010, 23:45
'nmake' is a Microsoft tool. I'm going to assume that Nokia don't have a license to include it with Qt, and since it comes with Visual Studio anyway, it would be daft if they did (after all, it requires Visual studio too)

For GCC, use MinGW Make instead.

Hm. But isn't the whole point of the Qt Creator IDE to give me a Qt-aware development environment so I don't have to purchase and muck about with Visual Studio? And if you need third party utilities to build release versions of Qt applications, shouldn't this be spelled out in the "How to deploy at Qt app" document?

I see "mingw32-make.exe" in the mingw directory. I'll give that a shot.

dramsey
20th February 2010, 01:02
Well, using "mingw32-make clean" does indeed clean out the intermediate files. Trying to use qmake initially got me the QMAKESPEC not defined message, but I figured that out, too.

Now, though, both "qmake -config debug" and "qmake -config release" both return instantly without actually, you know, building anything.

I've used Qt with Eclipse under Linux for some other projects. It was never anywhere near this hard just generating a release. I must be overlooking something painfully obvious, or perhaps the Windows support just isn't there yet...

squidge
20th February 2010, 09:19
Hm. But isn't the whole point of the Qt Creator IDE to give me a Qt-aware development environment so I don't have to purchase and muck about with Visual Studio? And if you need third party utilities to build release versions of Qt applications, shouldn't this be spelled out in the "How to deploy at Qt app" document?
You don't need Visual Studio, you only need it if you want to use nmake. GCC is perfectly capable on its own if you don't want to use Visual Studio.


Now, though, both "qmake -config debug" and "qmake -config release" both return instantly without actually, you know, building anything.qmake builds makefiles, it doesn't build anything else. You need to use your favourite make application to actually do the building. Eg. mingw32-make, or nmake.

Alternatively, you can just use the QtCreator IDE to do all this for you, and then copy the generated exe and appropriate dlls to your distribution directory, then pack up that dir and distribute.

dramsey
21st February 2010, 02:00
Alternatively, you can just use the QtCreator IDE to do all this for you, and then copy the generated exe and appropriate dlls to your distribution directory, then pack up that dir and distribute.

You know, I would really, really like to do that, since I am using QTCreator. But the "How to deploy your application" notes online don't seem to know about Creator. Simply trying to run the .exe files it produces results in a seemingly endless list of missing DLLs. Is there a way to get it to grab the DLLs for me, or do I have to search them out myself?

squidge
21st February 2010, 09:15
What you need is something like http://dependencywalker.com/

codeslicer
21st February 2010, 15:54
I'll explain how I deploy my apps. I use nmake at the moment. First of all, unless you have a commercial license, you can't statically link Qt applications. In addition, statically linking all those examples will take up like 5GBs of your hard drive, because the compiler has to embed all those DLLs like QtCore and QtGui, etc into each example.

You have two options then: use nmake or use mingw32.

If you want to use nmake, first install Visual Studio, then install the MSVC 2008 version of Qt from the Qt downloads page. If you install that in C:\Qt\4.6.2, right click on My Computer, go to Advanced, Environment Variables, and add C:\Qt\4.6.2\bin to your system PATH variable. Then, just download Qt Creator separately from downloads, and if it's not already configured, add C:\Qt\4.6.2\qmake\qmake.exe to the list.

If you want to use mingw32, all you need to do is install the Qt SDK, which does everything for you (I believe). Running Qt Creator and building applications will be automatic.

Once you're ready to distribute your application to others, you need to remember to include the Qt libraries in your installation file. You can check what libraries are required using dependency walker (linked above), because not everyone has the Qt libraries installed on their computer, nor does everyone have the .NET framework installed. If you use the Qt SDK, you just need to package in mingwm32.dll (something like that) and QtGui.dll and QtCore.dll, and any others you used. Also, make sure to rebuild your app for Release so it's smaller. For the installer, I like to use the free HM NIS Edit tool along with NCIS. Just run the wizard for a quick configuration of your setup file.

Good luck!

~codeslicer

squidge
21st February 2010, 22:08
First of all, unless you have a commercial license, you can't statically link Qt applications. Not exactly true. You can statically link Qt applications under the terms of t he GPL license if you don't have a commercial license. This does mean however that anyone can request a copy of the source code, and you must send it to them (or point them to where they can find it).

Lawand
22nd February 2010, 09:08
General tips for generating Qt static dlls (tested using Qt SDK 2010.01 and 2009.05)
1. Use windows XP
2. Use "Qt Command Prompt" (found in start menu > programs) instead of the regular command prompt
3. Don't build phonon (unless the have installed the SDKs mentioned in Qt for Windows Requirements (http://doc.trolltech.com/4.6/requirements-win.html)).

In other words, open up the "Qt Command Prompt" after a fresh Qt installation, then type in:

configure -static -release -no-phonon -platform win32-g++

Then:

mingw32-make

And now, when you build a Qt application, the only dlls required to be shipped are mingwm10.dll and possibly libgcc_s_dw2-1.dll (both found at <mingw-directory>\bin which would typically be C:\Qt\2010.01\mingw\bin). And the size of these two combined together is about 50kb...