X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=examples%2Fcross-compiling-windows-binary.mdwn;h=9908981a73c2f980c17bcfe0f7463230c2c8abb3;hb=e5406abde6714ee5b0ed56245a9e984e02cd45ec;hp=fbfba1e571265b32211a6861ba2e0cb8e0a17766;hpb=92c1ef34e1f369278a63eb7ffd0d4cd72ebfbeeb;p=wiki diff --git a/examples/cross-compiling-windows-binary.mdwn b/examples/cross-compiling-windows-binary.mdwn index fbfba1e..9908981 100644 --- a/examples/cross-compiling-windows-binary.mdwn +++ b/examples/cross-compiling-windows-binary.mdwn @@ -24,14 +24,14 @@ The idea is simple: There are only a few packages that need to be installed as root to get started: - sudo apt-get install mingw32 wine git-core + sudo apt-get install mingw-w64 wine git-core quilt sudo apt-get build-dep tinc Other Linux distributions may also have MinGW packages, use their respective package management tools to install them. Debian installs the cross-compiler -in `/usr/i586-mingw32msvc/`. Other distributions might install it in another +in `/usr/i686-w64-mingw32/`. Other distributions might install it in another directory however, for example `/usr/i686-pc-mingw32/`. Check in which directory -it is installed, and replace all occurences of `i586-mingw32msvc` in this +it is installed, and replace all occurences of `i686-w64-mingw32` in this example with the correct name from your distribution. ### Setting up the build directory and getting the sources @@ -52,15 +52,17 @@ up the necessary environment variables so configure scripts and Makefiles will use the MinGW version of GCC and binutils: mkdir $HOME/bin - cat >$HOME/bin/mingw << EOF + cat >$HOME/bin/mingw << 'EOF' #!/bin/sh - export CC=i586-mingw32msvc-gcc - export CXX=i586-mingw32msvc-g++ - export CPP=i586-mingw32msvc-cpp - export RANLIB=i586-mingw32msvc-ranlib - export PATH="/usr/i586-mingw32msvc/bin:$PATH" + PREFIX=i686-w64-mingw32 + export CC=$PREFIX-gcc + export CXX=$PREFIX-g++ + export CPP=$PREFIX-cpp + export RANLIB=$PREFIX-ranlib + export PATH="/usr/$PREFIX/bin:$PATH" exec "$@" EOF + chmod u+x $HOME/bin/mingw If `$HOME/bin` is not already part of your `$PATH`, you need to add it: @@ -78,8 +80,8 @@ time it is needed. Cross-compiling LZO is easy: - cd $HOME/mingw/lzo2-2.03 - ./configure --host=i586-mingw32msvc + cd $HOME/mingw/lzo2-2.08 + ./configure --host=i686-w64-mingw32 make DESTDIR=$HOME/mingw make install @@ -88,25 +90,19 @@ Cross-compiling LZO is easy: Cross-compiling Zlib is also easy, but a plain `make` failed to compile the tests, so we only build the static library here: - cd $HOME/mingw/zlib-1.2.3.3.dfsg + cd $HOME/mingw/zlib-1.2.8.dfsg mingw ./configure mingw make libz.a DESTDIR=$HOME/mingw mingw make install -### Compiling OpenSSL +### Compiling LibreSSL -OpenSSL is always a bit hard to compile, because they have their own -`Configure` script that needs some tweaking. There is also a small bug in -e_os2.h that breaks compilation with recent versions of GCC. First download -this [[openssl-cross-compilation.diff]] to your home directory, then patch -OpenSSL, and then compile as usual. Do not use the `-j` option when compiling -OpenSSL, it will break. +Tinc can use either OpenSSL or LibreSSL. The latter is recommended. - cd $HOME/mingw/openssl-0.9.8k - patch < $HOME/openssl-cross-compilation.diff - mingw ./Configure --openssldir=$HOME/mingw/usr/local mingw - mingw make - mingw make install + cd $HOME/mingw/libressl-2.3.3 + CC=i686-w64-mingw32-gcc ./configure --host=i686-w64-mingw32 + make + DESTDIR=$HOME/mingw make install ### Compiling tinc @@ -117,14 +113,14 @@ this is not necessary. cd $HOME/mingw/tinc autoreconf -fsi - ./configure --host=i586-mingw32msvc --with-openssl=$HOME/mingw/usr/local + ./configure --host=i686-w64-mingw32 --with-zlib=$HOME/mingw/usr/local make ### Testing tinc Since Wine was installed, you can execute the resulting binary even on Linux. -You cannot do much however, since tinc requires a TAP-Win32 device, which is -not available in Wine. Still, the following command should work: +Wine does not provide a TAP-Win32 device, but you can use the `DeviceType = dummy` option to test it without. +The following command should work in any case: $HOME/mingw/tinc/src/tincd.exe --help