I tend not to like cross-compiling, but sometimes it’s just the simplest solution, particularly if Windows and autotools come into the mix. Recently, I wanted to build xz for Windows, and build it in some particular ways.
windres (the GNU Windows resource compiler) will eat CPPFLAGS
, but it won’t process most of them the same way. I often like to use it as a shorthand for both C++ and C compiler options (like -O2
), but if windres is in play, only put preprocessor related things. As an example, if you enter -O2
for CPPFLAGS
, you get unknown format type `2'
.
If you need to target pre-Windows XP, be sure that the compiler is before 7.3. This patch has a hard dependency on a symbol that exists only on XP.
The end result is now I have a cursed xz for an even more cursed operating system: