Crosscompile Mingw + OpenSSL + Qt4 for Windows on Linux

this is deprecated and have been long replaced by the mingw-w64 packages.

For the longest time I used Mingw + cmake on top of wine to cross compile my Qt4 apps for windows, then I was bored one day, tired of how slow it is to recompile qt4 on wine and decided to try to get it to work with a native gcc instead of the overhead with wine.
So here goes.

This was done on Gentoo Linux, please don't ask me how to do it on other distros.

Assumptions :

1. You know your way around the linux shell and have portage privileges.
2. You're not scared from compiling things by hand.
3. You already have Qt4 installed and it is the same version as the windows source we gonna build.
4. Your working path will be ~/win32.
5. You have a working wine setup.

Part 1 - Meet the Toolchain :

*Important* due to the way the gentoo build works, you have to use -static-libgcc while compiling with mingw's g++ to elemenate the dependacy on libgcc_s_sjlj-1.dll.

You don't need root access anymore.

Part 2 - OpenSSL Time :

The main reason I added this part is the fact my project relays heavly on crypto, so might as well have Qt4 built with OpenSSL support.
If you don't need crypto / https support in QtNetwork, you can skip this and pass -no-openssl to Qt's configure.exe below.

If all goes well you will have out/libeay32.dll and out/libssl32.dll which is all we need.

Part 3 - It's hammer time aka Qt4 :

Well, if all went well up this point, you should have a working native Mingw + OpenSSL + Qt4 on linux without the need of using wine + gcc.

Check later for how to use it with cmake!

Enjoy.

References :
Mingw + Qt4 guide, their approche of using the linux version's configure script didn't work for me.
Mingw + OpenSSL guide, pretty much the build script I used minus some other fixes I found online.
OpenSSL mailing list.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTMLtags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">