X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=examples%2Fcross-compiling-windows-binary.mdwn;h=27ea13bd8a3610e2863d67307ebe571cdbf2f7d8;hb=207b37b1d5a26d9b30d5e776dd27d096a285a87b;hp=2af6c579f33f7b3d554348e3afae6cb4730ed9dd;hpb=ad8f68f7d9acca385b921530d1b5d4cefc1de531;p=wiki diff --git a/examples/cross-compiling-windows-binary.mdwn b/examples/cross-compiling-windows-binary.mdwn index 2af6c57..27ea13b 100644 --- a/examples/cross-compiling-windows-binary.mdwn +++ b/examples/cross-compiling-windows-binary.mdwn @@ -8,6 +8,9 @@ is much faster. It is also much easier to get all the dependencies in a modern distribution. Therefore, this howto deals with cross-compiling tinc with MinGW under Linux on a Debian distribution. +The result is a 32-bit executable. If you want to create a 64-bit executable, +have a look at the [[64-bit cross-compilation example|examples/cross-compiling-64-bit-windows-binary]]. + ### Overview The idea is simple: @@ -24,6 +27,13 @@ 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 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 +directory however, for example `/usr/i686-pc-mingw32/`. Check in which directory +it is installed, and replace all occurences of `i586-mingw32msvc` in this +example with the correct name from your distribution. + ### Setting up the build directory and getting the sources We will create a directory called `mingw/` in the home directory. We use @@ -57,7 +67,8 @@ If `$HOME/bin` is not already part of your `$PATH`, you need to add it: > export PATH="$HOME/bin:$PATH" We use this script to call `./configure` and `make` with the right environment -variables. You can also run the export commands from the `mingw` script by +variables, but only when the `./configure` script doesn't support cross-compilation itself. +You can also run the export commands from the `mingw` script by hand instead of calling the mingw script for every `./configure` or `make` command, or execute `$HOME/bin/mingw $SHELL` to get a shell with these environment variables set, but in this howto we will call it explicitly every @@ -67,10 +78,10 @@ time it is needed. Cross-compiling LZO is easy: -> cd $HOME/lzo2-2.03 -> mingw ./configure --host=mingw32 -> mingw make -> DESTDIR=$HOME/mingw mingw make install +> cd $HOME/mingw/lzo2-2.03 +> ./configure --host=i586-mingw32msvc +> make +> DESTDIR=$HOME/mingw make install ### Compiling Zlib @@ -106,8 +117,8 @@ this is not necessary. > cd $HOME/mingw/tinc > autoreconf -fsi -> mingw ./configure --host=mingw32 --with-openssl=$HOME/mingw/usr/local -> mingw make +> ./configure --host=i586-mingw32msvc --with-openssl=$HOME/mingw/usr/local +> make ### Testing tinc