1 | Installing OpenVPN-2.3.8 with non-standard library/header file locations: |
---|
2 | |
---|
3 | Occasionally, a user or developer may want to build OpenVPN using |
---|
4 | source tarballs like LZO (real-time compression library), OpenSSL |
---|
5 | (needed for encryption) (0.9.8 or higher, 1.0.2d is the latest |
---|
6 | version as of this writing), PolarSSL (alternative encryption |
---|
7 | library, version 1.1 or higher), LibPAM, or PKCS, etc. |
---|
8 | |
---|
9 | The source code for LZO real-time compression library can be found at: |
---|
10 | |
---|
11 | http://www.oberhumer.com/opensource/lzo/ |
---|
12 | |
---|
13 | The source code for the OpenSSL encryption library can be found at: |
---|
14 | |
---|
15 | http://www.openssl.org |
---|
16 | |
---|
17 | The source code for the PolarSSL encryption library can be found at: |
---|
18 | |
---|
19 | https://polarssl.org/ |
---|
20 | |
---|
21 | Below are some variables which can be added to the './configure' line |
---|
22 | to let GCC know where to find various header files and/or library files. |
---|
23 | |
---|
24 | Variables with _CFLAGS typically take the following form: |
---|
25 | |
---|
26 | nnn_CFLAGS="-I<path to include files>" |
---|
27 | |
---|
28 | Note the '-I' before the <path to include files> |
---|
29 | |
---|
30 | Variables with _LIBS typically take the following form: |
---|
31 | |
---|
32 | nnn_LIBS="-L<path to library (static or shared) files> |
---|
33 | |
---|
34 | Note the '-L' before the <path to library (static or shared) files> |
---|
35 | |
---|
36 | also make sure to tell OpenVPN where to 'look' for the libraries |
---|
37 | with -lssl and -lcrypto flags on your _LIBS options. |
---|
38 | |
---|
39 | As an example, here is what the options would look for using OpenSSL |
---|
40 | built from source tarball (which installs in /usr/local/ssl) and using |
---|
41 | LZO built from source tarball: |
---|
42 | |
---|
43 | ./configure LZO_CFLAGS="-I/usr/local/include/lzo" \ |
---|
44 | LZO_LIS="--L/usr/local/lib" \ |
---|
45 | OPENSSL_SSL_CFLAGS="-I/usr/local/ssl/include/openssl" \ |
---|
46 | OPENSSL_SSL_LIBS="-L/usr/local/ssl/lib -lssl" \ |
---|
47 | OPENSSL_CRYPTO_LIBS="-L/usr/local/ssl/lib -lcrypto" \ |
---|
48 | OPENSSL_CRYPTO_CFLAGS="-I/usr/local/ssl/include/openssl" \ |
---|
49 | |
---|
50 | Note: the above could also be entered on a single line with a space |
---|
51 | between each option. |
---|
52 | |
---|
53 | The CFLAGS option 'LZO_CFLAGS' specifies where the LZO header/include |
---|
54 | files can be found by GCC, and the LIBS option 'LZO_LIBS' specifies |
---|
55 | where the LZO library files can be found by GCC. |
---|
56 | |
---|
57 | The above example is from a default install of LZO-2.0.9 using the |
---|
58 | following build for LZO: |
---|
59 | |
---|
60 | ./configure; make; make check; make test; make install |
---|
61 | |
---|
62 | As you can see, the CFLAGS option 'OPENSSL_SSL_CFLAGS/OPENSSL_CRYPTO_CFLAGS' |
---|
63 | gives the full path where GCC can find the source header/include files for |
---|
64 | OpenSSL and the LIBS option 'OPENSSL_SSL_LIBS/OPENSSL_CRYPTO_LIBS' gives |
---|
65 | the full path where GCC can find the library files for OpenSSL. |
---|
66 | |
---|
67 | The above example is from a default install of OpenSSL-1.0.2d using the |
---|
68 | following build for OpenSSL: |
---|
69 | |
---|
70 | ./config; make; make test; make install |
---|
71 | |
---|
72 | This also assumes you unpacked the source tarball(s) in |
---|
73 | /usr/local/src, and you have the following layout below |
---|
74 | (your operating system may have a different layout): |
---|
75 | |
---|
76 | drwxr-xr-x. 2 root root 4096 Aug 3 19:57 bin |
---|
77 | drwxr-xr-x. 2 root root 4096 Aug 16 2014 etc |
---|
78 | drwxr-xr-x. 2 root root 4096 Aug 16 2014 games |
---|
79 | drwxr-xr-x. 5 root root 4096 Aug 4 15:01 include |
---|
80 | drwxr-xr-x. 7 root root 4096 Aug 4 15:01 lib |
---|
81 | drwxr-xr-x. 4 root root 4096 Aug 3 19:57 lib64 |
---|
82 | drwxr-xr-x. 2 root root 4096 Aug 16 2014 libexec |
---|
83 | drwxr-xr-x. 6 root root 4096 Aug 3 19:57 openssl |
---|
84 | drwxr-xr-x. 2 root root 4096 Aug 16 2014 sbin |
---|
85 | drwxr-xr-x. 6 root root 4096 Jul 31 19:25 share |
---|
86 | drwxr-xr-x. 42 root root 4096 Aug 4 14:56 src |
---|
87 | drwxr-xr-x. 9 root root 4096 Aug 4 14:03 ssl |
---|
88 | |
---|
89 | Here is a sample of various flags below can be added |
---|
90 | to the ./configure line as additional options: |
---|
91 | |
---|
92 | LZO_LIBS <full path to LZO static/shared library files> |
---|
93 | LZO_CFLAGS <full path to LZO include/header files> |
---|
94 | POLARSSL_LIBS <full path to PolarSSL static/shared library files> |
---|
95 | POLARSSL_CFLAGS <full path to PolarSSL include/header files> |
---|
96 | OPENSSL_SSL_LIBS <full path to OpenSSL SSL static/shared library files> |
---|
97 | OPENSSL_SSL_CFLAGS <full path to OpenSSL SSL include/header files> |
---|
98 | OPENSSL_CRYPTO_LIBS <full path to OpenSSL Crypto static/shared library files> |
---|
99 | OPENSSL_CRYPTO_CFLAGS <full path to OpenSSL Crypto include/header files> |
---|
100 | PKCS11_HELPER_LIBS <full path to PKCS11 Helper static/shared library files> |
---|
101 | PKCS11_HELPER_CFLAGS <full path to PKCS11 Helper include/header files> |
---|
102 | LIBPAM_LIBS <full path to PAM static/shared library files> |
---|
103 | LIBPAM_CFLAGS <full path to PAM library include/header files> |
---|
104 | |
---|
105 | Here is an example if PAM/LibPam is build from source and the header files |
---|
106 | are installed in /usr/local/pam/include and the library files are installed |
---|
107 | in /usr/local/pam/lib: |
---|
108 | |
---|
109 | ./configure LIBPAM_CFLAGS="-I/usr/local/pam/include" LIBPAM_LIBS="-L/usr/local/pam/lib" |
---|
110 | |
---|
111 | If the PAM library files were stored in '/usr/local/lib', and the header files were |
---|
112 | stored in '/usr/local/include', the 'configure' line would look like this: |
---|
113 | |
---|
114 | ./configure LIBPAM_CFLAGS="-I/usr/local/include" LIBPAM_LIBS="-L/usr/local/lib" |
---|
115 | |
---|