Build OpenVPN from source code in Visual Studio 2008/2013

  1. prepare
    1.  download lzo(lzo-2.09.tar.gz) from here:
    2. download openvpn( from here:
    3. download tap-windows6(download as zip) from here:
    4. you need to download openssl, and compile.
  2. compile
    1. create a empty console project, and delete all .h,.c, change character encoding from unicode to none
    2. drag all .c from lzo to the project
    3. drag all .c from openvpn to the project
    4. set include: openvpn-2.3.8\;openvpn-2.3.8\src\compat\;lzo-2.09\include\;tap-windows6\src\;openvpn-2.3.8\include\
    5. set libraries: libeay32.lib ssleay32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib
    6.  append preprocessors:
    7. copy as config-msvc-version.h, and modify it as this, so that we can use official prebuilt drivers directly :
      1. #define PACKAGE_NAME “openvpn”
        #define PACKAGE_STRING “openvpn 2.3.8”
        #define PACKAGE_TARNAME “openvpn”
        #define PACKAGE “openvpn”
        #define PACKAGE_VERSION “2.3.8”
        #define TAP_WIN_COMPONENT_ID “tap0901”
        #define TAP_WIN_MIN_MAJOR 9
        #define TAP_WIN_MIN_MINOR 21
    8. open config-msvc.h, modify these lines,
      1. // #define ENABLE_DEBUG 1
      2. // #define ENABLE_HTTP_PROXY 1
      3. //#define ENABLE_PKCS11 1
    9. modify project to use /MT (or /MTd if debug build)
    10. time to build
  3. voila! our own build of openvpn is done! no runtime dependence, only single exe file.
  4. what can we do next?
    1. modify the protocol to bypass some firewall, for example, the one in China.
    2. modify the auth to allow more auth type, for example, auth by hardware
  5. last but not the least, backup the current lzo,openvpn,tap-windows7 source code in docs folder of the source code, and submit all into git. we may need to take a look at the original code when we have modified a lot of source code.


  1. build openvpn-gui from source code

2 thoughts on “Build OpenVPN from source code in Visual Studio 2008/2013

  1. hi my name is wajih and i want to build 2.3.13 latest open with vs 2013 currently i am following your tutorial but i am not getting successful results i am stuck with kindly tell me what i am missing.

    Here are some error screen shots.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s