build openvpn3

Weekly dev snapshots are available for testing.
We talk about them here. Testing features in the dev snapshot helps the features make it to stable.
Forum rules
Please report your experience with testing branch. Include what you were using and how
If there is a problem, the more info the better!
Post Reply
Fogord
OpenVpn Newbie
Posts: 1
Joined: Tue Jul 11, 2017 3:48 pm

build openvpn3

Post by Fogord » Tue Jul 11, 2017 4:19 pm

Hi everybody,

Please, help me to resolve following problem. I stuck with build opnevp3 for mac. I use the instructions

Code: Select all

Building OpenVPN 3 on Mac OS X El Capitan (10.11)

Official link: https://staging.openvpn.net/openvpn3/

OpenVPN 3 should be built in a non-root Mac OS X account. Make sure that Xcode is installed with optional command-line tools. (These instructions have been tested with Xcode 7.3.1).

Step 1

Create a directory ~/src and ~/src/mac. This can be done with the command:

$ mkdir -p ~/src/mac
Step 2

Expand the OpenVPN 3 tarball:

$ cd ~/src
$ tar xf openvpn3.tar.gz
Step 3

Export the shell variable O3 to point to the OpenVPN 3 top level directory:

$ export O3=~/src/openvpn3
Step 4

See the file ~/src/openvpn3/lib-versions for the expected version numbers of each dependency. If you want to use a different version of the library than listed here, you can edit this file.

export LZO_VERSION=lzo-2.06
export LZ4_VERSION=lz4-r131
export SNAPPY_VERSION=snappy-1.1.3
export POLARSSL_VERSION=polarssl-1.3.6
export OPENSSL_VERSION=openssl-1.0.1g
export BOOST_VERSION=boost_1_61_0
[Boost] (http://www.boost.org/) 
https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.gz

[PolarSSL (1.3.4 or higher)] (https://polarssl.org/) 
https://tls.mbed.org/download/polarssl-1.3.6-gpl.tgz

[OpenSSL (1.0.1)] (http://www.openssl.org/) 
ftp://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1g.tar.gz

[Snappy] (https://code.google.com/p/snappy/) 
https://github.com/google/snappy/releases/download/1.1.3/snappy-1.1.3.tar.gz

[LZ4] (https://code.google.com/p/lz4/) 
https://codeload.github.com/Cyan4973/lz4/tar.gz/r131

Note that while LZO is listed in lib-versions, it is not required for Mac builds.

OpenSSL is required, however OpenVPN 3 for Mac doesn't use OpenSSL in the standard way. Instead, it cherry-picks some ASM-optimized crypto and hash algorithms from OpenSSL to speed up PolarSSL's low-level crypto processing, and assembles them into a library called libminicrypto.a.

Step 5

Download these dependency libraries source tarballs (.tar.gz or .tgz) in Step 4 and place them into

$ ~/Downloads
Step 6

Add build target in ~src/openvpn3/scripts/mac/build-boost

Line 18: export TARGETS="osx osx64 osx-dbg"
Step 7

Update environment variables in ~src/openvpn3/vars-osx

Line 6: export MIN_DEPLOY_TARGET="-mmacosx-version-min=10.11"
Line 8: export OTHER_COMPILER_FLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++"
Step 8

Update environment variables in ~src/openvpn3/vars-osx64

Line 6: export MIN_DEPLOY_TARGET="-mmacosx-version-min=10.11"
Line 8: export OTHER_COMPILER_FLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++"
Be aware that your double quote marks should be " , not ”

Step 9

Update Jam file path in ~src/openvpn3/boost/build-boost

Line 31: cat >>tools/build/boost-build.jam <<EOF
Line 39: tail -30 tools/build/boost-build.jam
Step 10

Update source code file path in ~src/openvpn3/lz4/build-lz4

Line 63: cd $LZ4_VERSION/lib
Step 11

Install cmake

$ brew install cmake
Step 12

Build the dependencies:

$ OSX_ONLY=1 $O3/scripts/mac/build-all
Step 13

Now build the OpenVPN 3 client executable:

$ cd $O3
$ . ./vars-osx64
$ . ./setpath
$ cd test/ovpncli

#export MACOSX_DEPLOYMENT_TARGET=10.11

$ GCC_EXTRA="-std=c++11" STRIP=1 PSSL=1 MINI=1 SNAP=1 LZ4=1 build cli
This will build the OpenVPN 3 client library with a small client wrapper (cli). It will also statically link in all external dependencies (Boost, PolarSSL, libminicrypto (derived from OpenSSL), LZ4, and Snappy), so "cli" may be distributed to other Macs and will run as a standalone executable. It's best to build OpenVPN 3 in C++11 mode to allow for the use of optimized move constructors. But keep in mind that OpenVPN 3 strictly follows the C++ 2003 standard (not C++ 2011), so building with -std=c++11 is optional for optimization purposes.

These build scripts will create a "fat" Mac OS X executable with support for both x86_x64 and i386 architectures, with a minimum deployment target of 10.6.x. The Mac OS X tuntap driver is not required, as OpenVPN 3 can use the integrated utun interface if available.

Enjoy it

To view the client wrapper options:

$ ./cli -h
To connect:

$ ./cli YOUR_OVPN_FILE (EX: client.ovpn)

then i was used the command

Code: Select all

$ GCC_EXTRA="-std=c++11" STRIP=1 PSSL=1 MINI=1 SNAP=1 LZ4=1 build cli
and got the following errors

Code: Select all

n-kv-mos23o-009:ovpncli home$ GCC_EXTRA="-std=c++11" STRIP=1 PSSL=1 MINI=1 SNAP=1 LZ4=1 build cli
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_io_object.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/io_service.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/wrapped_handler.hpp:18:
In file included from /Users/home/src/mac/boost/boost/asio/detail/bind_handler.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/detail/handler_alloc_helpers.hpp:19:
/Users/home/src/mac/boost/boost/asio/detail/addressof.hpp:31:12: error: no member
      named 'addressof' in namespace 'std'
using std::addressof;
      ~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_io_object.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/io_service.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/wrapped_handler.hpp:18:
In file included from /Users/home/src/mac/boost/boost/asio/detail/bind_handler.hpp:19:
/Users/home/src/mac/boost/boost/asio/detail/handler_alloc_helpers.hpp:37:56: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
  return asio_handler_allocate(s, boost::asio::detail::addressof(h));
                                  ~~~~~~~~~~~~~~~~~~~~~^
/Users/home/src/mac/boost/boost/asio/detail/handler_alloc_helpers.hpp:48:54: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
  asio_handler_deallocate(p, s, boost::asio::detail::addressof(h));
                                ~~~~~~~~~~~~~~~~~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_io_object.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/io_service.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/wrapped_handler.hpp:18:
In file included from /Users/home/src/mac/boost/boost/asio/detail/bind_handler.hpp:20:
/Users/home/src/mac/boost/boost/asio/detail/handler_cont_helpers.hpp:37:28: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
      boost::asio::detail::addressof(context));
      ~~~~~~~~~~~~~~~~~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_io_object.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/io_service.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/wrapped_handler.hpp:18:
In file included from /Users/home/src/mac/boost/boost/asio/detail/bind_handler.hpp:21:
/Users/home/src/mac/boost/boost/asio/detail/handler_invoke_helpers.hpp:37:54: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
  asio_handler_invoke(function, boost::asio::detail::addressof(context));
                                ~~~~~~~~~~~~~~~~~~~~~^
/Users/home/src/mac/boost/boost/asio/detail/handler_invoke_helpers.hpp:49:54: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
  asio_handler_invoke(function, boost::asio::detail::addressof(context));
                                ~~~~~~~~~~~~~~~~~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_io_object.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/io_service.hpp:767:
In file included from /Users/home/src/mac/boost/boost/asio/impl/io_service.hpp:71:
In file included from /Users/home/src/mac/boost/boost/asio/detail/task_io_service.hpp:196:
In file included from /Users/home/src/mac/boost/boost/asio/detail/impl/task_io_service.hpp:19:
/Users/home/src/mac/boost/boost/asio/detail/completion_handler.hpp:49:36: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
    ptr p = { boost::asio::detail::addressof(h->handler_), h, h };
              ~~~~~~~~~~~~~~~~~~~~~^
/Users/home/src/mac/boost/boost/asio/detail/completion_handler.hpp:60:32: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
    p.h = boost::asio::detail::addressof(handler);
          ~~~~~~~~~~~~~~~~~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_socket.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/basic_io_object.hpp:19:
In file included from /Users/home/src/mac/boost/boost/asio/io_service.hpp:767:
In file included from /Users/home/src/mac/boost/boost/asio/impl/io_service.hpp:71:
In file included from /Users/home/src/mac/boost/boost/asio/detail/task_io_service.hpp:196:
/Users/home/src/mac/boost/boost/asio/detail/impl/task_io_service.hpp:43:49: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
    typename op::ptr p = { boost::asio::detail::addressof(handler),
                           ~~~~~~~~~~~~~~~~~~~~~^
/Users/home/src/mac/boost/boost/asio/detail/impl/task_io_service.hpp:63:47: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
  typename op::ptr p = { boost::asio::detail::addressof(handler),
                         ~~~~~~~~~~~~~~~~~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/datagram_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_service.hpp:29:
/Users/home/src/mac/boost/boost/asio/detail/reactive_null_buffers_op.hpp:55:36: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
    ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
              ~~~~~~~~~~~~~~~~~~~~~^
/Users/home/src/mac/boost/boost/asio/detail/reactive_null_buffers_op.hpp:67:32: error: 
      no member named 'addressof' in namespace 'boost::asio::detail'
    p.h = boost::asio::detail::addressof(handler.handler_);
          ~~~~~~~~~~~~~~~~~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/datagram_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_accept_op.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_holder.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:21:
/Users/home/src/mac/boost/boost/asio/detail/shared_ptr.hpp:31:7: error: no member
      named 'shared_ptr' in namespace 'std'; did you mean '::boost::shared_ptr'?
using std::shared_ptr;
      ^~~~~~~~~~~~~~~
      ::boost::shared_ptr
/Users/home/src/mac/boost/boost/exception/exception.hpp:148:11: note: 
      '::boost::shared_ptr' declared here
    class shared_ptr;
          ^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/datagram_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_accept_op.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_holder.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:23:
/Users/home/src/mac/boost/boost/asio/detail/weak_ptr.hpp:31:12: error: no member
      named 'weak_ptr' in namespace 'std'
using std::weak_ptr;
      ~~~~~^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/datagram_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_accept_op.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_holder.hpp:20:
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:64:9: error: unknown
      type name 'weak_ptr'
typedef weak_ptr<void> weak_cancel_token_type;
        ^
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:64:17: error: expected
      unqualified-id
typedef weak_ptr<void> weak_cancel_token_type;
                ^
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:293:11: error: unknown
      type name 'weak_cancel_token_type'; did you mean 'shared_cancel_token_type'?
    const weak_cancel_token_type& cancel_token, const char* host,
          ^~~~~~~~~~~~~~~~~~~~~~
          shared_cancel_token_type
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:63:26: note: 
      'shared_cancel_token_type' declared here
typedef shared_ptr<void> shared_cancel_token_type;
                         ^
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:310:11: error: unknown
      type name 'weak_cancel_token_type'; did you mean 'shared_cancel_token_type'?
    const weak_cancel_token_type& cancel_token,
          ^~~~~~~~~~~~~~~~~~~~~~
          shared_cancel_token_type
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:63:26: note: 
      'shared_cancel_token_type' declared here
typedef shared_ptr<void> shared_cancel_token_type;
                         ^
In file included from cli.cpp:28:
In file included from /Users/home/src/mac/boost/boost/asio.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/basic_datagram_socket.hpp:21:
In file included from /Users/home/src/mac/boost/boost/asio/datagram_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_service.hpp:30:
In file included from /Users/home/src/mac/boost/boost/asio/detail/reactive_socket_accept_op.hpp:24:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_holder.hpp:20:
In file included from /Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:333:
/Users/home/src/mac/boost/boost/asio/detail/impl/socket_ops.ipp:3246:11: error: 
      unknown type name 'weak_cancel_token_type'; did you mean
      'shared_cancel_token_type'?
    const weak_cancel_token_type& cancel_token, const char* host,
          ^~~~~~~~~~~~~~~~~~~~~~
          shared_cancel_token_type
/Users/home/src/mac/boost/boost/asio/detail/socket_ops.hpp:63:26: note: 
      'shared_cancel_token_type' declared here
typedef shared_ptr<void> shared_cancel_token_type;
                         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: can't open file: cli (No such file or directory)

Post Reply