2of1
half a nibble of another

Home
Projects
About
Aug

23

Cross-compiling a Qt win32 app on Linux

Filed Under (Coding, Compilers, Linux, Open source) by 2of1 on 23-08-2010

I’ve been looking for a way to compile an app developed with Qt Creator on Linux for Windows.

I came across this but I needed to tweak it before it worked so I decided to blog my own mini-guide (tested working with with Qt 4.6.3).

This assumes that you already have the Qt SDK (for Linux) installed.

  1. The first thing to do is download and install the MinGW cross compiler
  2. Then download the Windows version of the Qt SDK. As it’s distributed as a Win package, you’ll need to either install it on windows and copy the necessary files across to your linux distro (what I did) or install it through Wine (not sure if this even works). You can cross-compile it as well if you’re being adventurous
  3. Place the Qt Win SDK libraries in /usr/lib32/qt4win32 and headers in /usr/include/qt4win32
  4. Copy /usr/share/qt4/mkspecs/win32-g++/ to /usr/share/qt4/win32-x-g++/
  5. In the above directory, replace qmake.conf with the one found here
  6. Make sure that the paths in qmake.conf match those of your system (see NOTE below); specifically QMAKE_CXX, QMAKE_LINK, QMAKE_INCDIR, QMAKE_INCDIR_QT, QMAKE_LIBDIR_QT
  7. Run qmake adding –spec win32-x-g++ command line arg. This should cross-compile your app.

NOTE: As my linux box is a x86_64, my /usr/lib is /usr/lib32. Please adjust this accordingly for your setup.

(2) Comments
Read More

Comments:

2 Responses to “Cross-compiling a Qt win32 app on Linux”

  1. redteam on 24 Feb 2011 at 2:52 am

    This works great on Kubuntu 10.10 with Qt4.7.0 and mingw installed from the repos. Only thing I would add is that it is essential that the win32 and linux Qt’s match exactly.

  2. matpen on 5 Nov 2011 at 2:21 am

    Here (http://blog.kermat.net/blog5.php/cross-compilation-with-qt) you can find a complete tutorial to set up a cross-compilation environment with Qt. There is also a downloadable script that automates the installation. Tested with Qt 4.7.2.

Leave a Reply

  • Recent Posts

    • ARM long branch
    • Mini-Namco #3: (Almost) Finished
    • Mini-Namco #2: Unit construction
    • Mini-Namco #1: Design
    • Simple C hashtable code
  • Archives

    • January 2012
    • September 2011
    • August 2011
    • July 2011
    • May 2011
    • March 2011
    • February 2011
    • January 2011
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
  • GitHub

    • code
    • d2d1headers
    • locateme
    • findjerusalem
    • seg7
    • userspace-krb
    • libgmail
    • preloader
    • linhook
  • qrcode

  • Site Search

  • Categories

    • Apps (7)
      • Preloader (1)
      • Symbian S60 (1)
      • VLC (4)
      • Wordpress (1)
    • Coding (28)
      • Assembly (1)
        • ARM (1)
      • C (12)
      • Compilers (5)
      • Direct2D API (4)
      • Linux kernel (2)
      • Networking (4)
      • Python (1)
      • Sqlite (1)
      • Version control (5)
        • Git (5)
    • Hacking (4)
      • Code injection (1)
      • Reverse engineering (3)
    • Hardware (4)
      • Arduino (1)
      • PCBs (3)
    • Linux (21)
      • Bash (1)
      • Tips & tricks (13)
      • Virtualization (1)
      • VNC (2)
      • Xmonad (1)
    • Open source (30)
    • Other stuffs (3)
    • Social (3)
      • DC9723 (2)
  • OctoFinderProgramming Blogs - Blog Catalog Blog Directory

    Locations of visitors to this page

© 2of1.