This is slightly outdated, will upload a new version with OpenSSL v1.0.0, also fixed the link to the mingw-openssl.sh script.
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 :
# Change 32 to 64 if you're trying to build for Win64, of course you'd need a 64bit Linux toolchain as well.
export cross=i686-pc-mingw32
emerge -av crossdev
# I decided to use the latest gcc version, however there's nothing stopping you from using 3.x.
# Start building the tool chain, go make some coffee, watch tv, or play a game until it's done.
crossdev --gcc 4.4.2 ${cross}
# Fix a bug in Qt4's corelib, also make sure to change 4.4.2 to whichever version of gcc you decided to use.
ln -s /usr/${cross}/usr/include/float.h /usr/lib/gcc/${cross}/4.4.2/include/g++-v4
*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.
Read more »