Comment 4 for bug 1338043

Revision history for this message
Tony Kelman (tkelman) wrote :

The cross-compile from my own set of SEH, win32-threading debs worked nicely.

There was one little hangup of strerror_s not existing in the msvcrt runtime when I try to run the cross-compiled binary on XP, but I think I can solve that with a configure flag in the library I'm building. Deciding to not support XP is an okay decision in my book, hopefully more people will agree with that over time.

Overall I was pleasantly surprised how painless and relatively quick (only about 20 minutes, on an old computer) it was to build the set of modified MinGW debs, it felt much faster than the last time I built GCC from source on a non-Debian distribution. Maybe just because cross-compilers don't go through the whole bootstrap process?

Anyway, in case it helps anyone who comes across this in the future, this was the set of steps I did to make it all work (reconstructed from my .bash_history):

mkdir ~/GCC
cd ~/GCC
apt-get source gcc-mingw-w64
sudo apt-get build-dep g++-mingw-w64
sudo apt-get build-dep gfortran-mingw-w64
cd gcc-mingw-w64-12
# change --enable-threads=posix to --enable-threads=win32
# and remove --enable-sjlj-exceptions from debian/rules
# change libgcc_s_sjlj-1.dll to libgcc_s_seh-1.dll in
# debian/gcc-mingw-w64-x86-64.install
dpkg-buildpackage -rfakeroot -uc -b
cd ..
sudo dpkg -i *.deb

This overwrites the existing SJLJ, posix-threading MinGW packages I had installed, but I'm okay with that for now and it should be easy to get them back if I need them.