Cross Compile on OS X for Windows and Linux



  • Just reporting something I just found out and tested.

    As you can see here:
    http://crossgcc.rts-software.org/doku.php?id=start

    Pierre Molinaro has compiled Qt 4.8.4 with MinGW so you can use Qt Creator on Mac OS X to build Windows applications:
    http://crossgcc.rts-software.org/doku.php?id=compiling_for_win32

    It is statically built so after compiling you end up with a single exe that you can run without the need of DLLs.
    I have just tested this on OS X 10.9, Qt Creator 3.0.1 and the application was tested on Windows XP SP3 inside Parallels.

    A quick tutorial:

    1. If you download it (gcc-4.8.0-qt-4.8.4-for-mingw32.dmg) you will have a DMG file, inside a PKG which you can install, it will install MinGW and Qt 4.8.4 on this directory:
      /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/

    2. Then go to Qt Creator, Preferences, Build & Run, Compilers and click on Add, select GCC and go to:
      /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-gcc/bin
      and choose i586-mingw32-gcc

    3. Apply changes then go to Qt Versions, click on Add and go to:
      /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-qt/bin
      and choose qmake

    4. Apply changes then go to Kits, click on Add and on Compiler combobox choose your newly added compiler.
      On Qt Version combobox choose your newly added 4.8.4 Qt, on debugger combobox I left it as None.

    5. Then you can just work on your project as you normally would.

    There is also Linux and ARM versions there but I didn't try those.



  • Very nice! Thanks for this, your directions were flawless.


  • Lifetime Qt Champion

    Hi,

    You should consider making a little wiki entry of this information, the forum post tends to get lost under the dust of time



  • I will see if I can do it, but the project isn't mine, Pierre might change it and thus the guide wouldn't work anymore. I just tested one of the binaries too.


  • Lifetime Qt Champion

    Ok, then the best is to talk with him about the wiki entry :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.