Cross Compile¶
On a Linux system you can compile binaries for windows by using a cross compile environment. Here are our notes for setting up a suitable cross compile environment:
sudo apt-get install mingw-w64 win-iconv-mingw-w64-dev libgcrypt-mingw-w64-dev # on a Ubuntu-based system
With these installed, on Ubuntu almost everything is available.
Except for gnutls, where the windows binaries need to be downloaded from here: https://www.gnutls.org/download.html
Unpack the binary zips (e.g. under $HOME/gnutls-win), then add a suitable symlink for the header files which are located under lib/includes, e.g.
cd win32-build mkdir include cd include ln -s ../lib/includes gnutls
both for the win32 and the win64 builds, accordingly. Additionally, the pkg-config file "gnutls.pc" contains the prefix=/usr/local, which is obviously wrong in our case. My suggestion is to edit the file lib/gnutls.pc and adapt the "prefix=..." entry to your actual path where the library was unpacked, i.e. the root path of where lib, bin directory and your hand-created include symlink reside.
For building gwenhywfar, now do the following for a win32 build (which seems to catch mismatching GWENHYWFAR_CB attributes best) and make sure to choose the PKG_CONFIG_PATH according to your local gnutls download:
mkdir build-mingw-w32 cd build-mingw-w32 PATH=/usr/i686-w64-mingw32/bin:$PATH \ ../configure --host=i686-w64-mingw32 \ --with-iconv=/usr/i686-w64-mingw32 --with-libgcrypt-prefix=/usr/i686-w64-mingw32 \ --with-libgpg-error-prefix=/usr/i686-w64-mingw32 \ --disable-binreloc --with-guis='' \ --disable-ssl \ --enable-error-on-warning \ PKG_CONFIG_PATH=$HOME/gnutls-win/gnutls-win32/lib
And additionally a 64bit target system can be compiled for, which might catch even further compiler warnings/errors:
mkdir build-mingw-w64 cd build-mingw-w64 PATH=/usr/x86_64-w64-mingw32/bin:$PATH \ ../configure --host=x86_64-w64-mingw32 \ --with-iconv=/usr/x86_64-w64-mingw32 --with-libgcrypt-prefix=/usr/x86_64-w64-mingw32 \ --with-libgpg-error-prefix=/usr/x86_64-w64-mingw32 \ --disable-binreloc --with-guis='' \ --disable-ssl \ --enable-error-on-warning \ PKG_CONFIG_PATH=$HOME/gnutls-win/gnutls-win64/lib