Silmor . de
Site Links:
Impressum / Publisher

Cross compiling Qt4/Win itself

Sorry, this article is work in progress. There is not much there yet.

Skip ahead to Part 3!

Here, there be dragons!

...and I don't mean the cute kind.

You'll need a completely built cross compiler in order to proceed. Read Part 1 of this series to find out how to do this.

If you want to use this for a commercial (non-GPL) project, you have to make sure you own the right licenses. According to Trolltech's support you need one for each developer on the platforms he/she actually develops on and at least one for each target platform - so that you can link against the correct runtime libs. Eg. if you have three developers, two working on Linux and one on Windows and your target platforms are Linux, Windows, and MacOS/X then you will need four licenses: one for each developer (twice X11, once Win32) and an extra one for the additional target platform MacOS/X.

Actually: it is a lot safer and faster to just compile Qt/Win32 under Windows. What I'm trying here is not for the faint-hearted - it requires quite some hacking and a good understanding of Unix-scripting.


This article will show how to cross compile the Qt4/Win32 OpenSource or Desktop edition. Though I tested it only on my commercial Desktop edition it should be adaptable to other editions as well.

A little warning in advance: I give no guarantees, no support. You don't even get what you see. If it sets fire to your house, don't blame me - you have been warned!

You need Qt/X11 and Qt/Win32, preferably with the same version number. Unpack both in parallel directories.

Build Process

Qt's configure.exe for Qt/Win goes through several steps to create its environment:

It then builds qmake and uses qmake to generate makefiles for the remainder of Qt. The main makefile in Qt's source directory then builds Qt, QDesigner, the examples and tutorials.

Building qmake

Qmake needs different qatomic files than Qt, because qmake is supposed to run on the host platform, while Qt is supposed to run on the target platform. Therefore the qmake sources and src/corelib/io/qfsfileengine_unix.cpp needs to be copied from the X11 version to the win32 sources. Then qmake/Makefile.unix needs to be adapted to compile qmake for the correct directories.

Building Qt

After setting qatomic.h to the windows version the remainder is a matter of calling qmake for each *.pro file and executing make.

Go on...

Read Part 3 of the series to find out how to cross compile Qt-Applications.

Webmaster: webmaster AT silmor DOT de