Cross-compiling OpenVPN

By | August 28, 2013

openvpn_logo

OpenVPN is an open source software application used for creating SSL/TLS VPN that provides secure point-to-point connections in routed or bridged configurations and remote access facilities.

Cross-compiling the latest version 2.3.2 is an easy procedure, no makefiles of other files have to be modified:

Download package
openvpn-2.3.2.tar.gz

Requirements
This library is built on top of OpenSSL and LZO. It’s quite probable that you already have both packages installed in your embedded device since they’re quite common.

Environment configuration
As normal, set the environment variables that make our life easier. Change them according to your needs. These settings are for an ARM based processor:

$ export HOST=arm-linux
$ export BUILD=i386-linux
$ export PREFIX=/home/projects/rootfs/usr/local

Configuration
I already have OpenSSL and LZO installed in my embedded system (buildroot installed them for me), however I had to specify where the LZO header files and library were located:

LZO_CFLAGS="-I$PREFIX/usr/include" 
LZO_LIBS="-L$PREFIX/usr/lib -llzo2" 
./configure 
--target=arm-linux 
--host=arm-linux 
--build=i686-pc-linux-gnu 
--prefix=$PREFIX 
--enable-static 
--enable-shared 
--enable-small 
--disable-plugins 
--disable-debug

Compilation and installation

make
make install

The last step will install some documentation that you can get rid of, a header file openvpn-plugin.h that you will need only if you compiile an OpenVPn plugin and the binary openvpn that is what you need.

Here are some tutorials for configuring an OpenVPN client/server and learning the basic ideas behind it:

That’s it. Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *