From Fedora Project Wiki
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
== Compiling QT applications and libraries ==
== Compiling QT applications and libraries ==


When compiling QT-based applications and libraries the compilation may fail with the message that the library ''QtGui'' could not be found. To resolve this one must use the following command:
When compiling QT-based applications and libraries the compilation may fail with the message that the library ''QtGui'' could not be found. To resolve this you can use the following command:
qmake-qt4 -spec win32-g++-cross
(See http://www.mail-archive.com/mingw@lists.fedoraproject.org/msg00442.html for the rationale about this)
 
For Fedora 13 or older you can use:
  qmake-qt4 -spec win32-fedora-cross QT_LIBINFIX=4
  qmake-qt4 -spec win32-fedora-cross QT_LIBINFIX=4


Line 18: Line 22:
== If having trouble during ./configure ==
== If having trouble during ./configure ==
Try mingw32-configure!
Try mingw32-configure!
== If having trouble with cmake ==
Try mingw32-cmake!
=== Create a static executable with cmake ===
mingw32-cmake -DCMAKE_EXE_LINKER_FLAGS=-static ...

Latest revision as of 21:46, 11 November 2010

Tips and tricks for using the Windows cross-compiler

Compiling QT applications and libraries

When compiling QT-based applications and libraries the compilation may fail with the message that the library QtGui could not be found. To resolve this you can use the following command:

qmake-qt4 -spec win32-g++-cross

(See http://www.mail-archive.com/mingw@lists.fedoraproject.org/msg00442.html for the rationale about this)

For Fedora 13 or older you can use:

qmake-qt4 -spec win32-fedora-cross QT_LIBINFIX=4

Using static libraries

Several MinGW packages in Fedora contain -static subpackages. These subpackages contain static libraries which can be used to create applications which contain no external dependencies on .DLL files.

When using these static libraries one must add some special #define's to the CFLAGS when building libraries and/or applications (depending on the static library used). If these CFLAGS are missing, the compilation of executables will most likely fail. The libraries which need additional CFLAGS are these:

GLib2:   -DGLIB_STATIC_COMPILATION -DGOBJECT_STATIC_COMPILATION
LibXML2: -DLIBXML_STATIC
Curl:    -DCURL_STATICLIB

If having trouble during ./configure

Try mingw32-configure!

If having trouble with cmake

Try mingw32-cmake!

Create a static executable with cmake

mingw32-cmake -DCMAKE_EXE_LINKER_FLAGS=-static ...