rfc2324.org - HowTo

Build OpenVPN for Windows using Mingw32

Vim - The Editor
Valid HTML 4.01 Strict Valid CSS!

This is a short description how to build OpenVPN for Windows using a linux build environment running ming32


Ok, you seem to be crazy enough to be willing to build an OpenVPN version for windows on yourself...

As I had to do so and know about the pain, I prepared some Makefiles and patches to let me and other people who have to do it (again) suffer less.


I asume that you're running any linux distribution and know how to handle it.
You should have build some pieces of software before and trying some crazy things like the described ones here, otherwise you might run into trouble if things don't work on the first try.


The current howto below describes how to build a version of OpenVPN which will run on a Windows machine (tested on WinXP).

It does not help you on building the tap-w32 driver included in openvpn source and binary release.

However this is not mission critical thing, as you have the ability to build your openvpn.exe out of the last official released versions source tree (which can be happily patched) and use the tap driver (+ batch files for installation) from the official openvpn release (same version!) for windows.

So you "just" exchange the openvpn.exe file.

If you can help building the tap-w32 driver on a linux machine using mingw32 and without using Microsoft™ DDK, please let me know!


You will need:

If you are running Debina GNU/Linux you might want to
apt-get install mingw32 mingw32-binutils build-essential.

Building the libraries

For builing OpenVPN you need precompiled lzo- and openssl libraries.

To make things easy, create an openvpn build tree directory e.g. called "myBuildTree" and therein a directory "lzo" and "openssl" for the libraries and one for openvpn itself.

The directory structure after downloading and extracting all the sources should look like this:


Building liblzo

So go to http://www.oberhumer.com/opensource/lzo/ and get the latest stable version of the LZO library and extract it in the "openvpn/lzo" dir.
(At the time of this writing, this is version 2.02).

Unpack the tarball in the above place, put the liblzo2-Makefile-mingw32 in the toplevel source directory and run

$ make -f liblzo2-Makefile-mingw32

This should provide you with a liblzo2.a file.

Building openssl

The harder part (at least when doing it without some nice prepared Makefile...) is the openssl library.
Go to http://www.openssl.org/ and download the latest stable version, (at the time of this writing this is version 0.9.8e), extract it in the openssl dir, put the openssl-Makefile-mingw32 in the toplevel source directory and run

$ make -f openssl-Makefile-mingw32

There should now be libcrypto.a, libeay32.a, libssl32.a, libssl.a in the out directory in the openssl source tree.

Congratulations, you've managend what took me some hours in rather few time.

Building OpenVPN

Let's go on and build OpenVPN using the libraries built before.

Download the latest version of OpenVPN (currently v2.0.9) from http://openvpn.net/download.html and extract the tarball in the openvpn directory.

Patch or replace the makefile.w32 file and run

$ make -f makefile.w32 static

Congratulations again, you should now be the proud owner of an openvpn.exe.

You can now copy this file on your windows box and exchange the shipped version with it.


All files referenced above can be found at http://files.rfc2324.org/patches/openvpn/build-for-w32/