summaryrefslogtreecommitdiff
path: root/BUILD.Windows
blob: ca0d25228d89497edec8561a57bec470c822df22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Open vSwitch support on Windows is a work in progress.  This file describes
the planned build system to compile Open vSwitch on Windows.  Once the work
is complete, this file will be replaced by a INSTALL.Windows file.

Autoconf, Automake and Visual C++:
---------------------------------
Open vSwitch on Linux uses autoconf and automake for generating Makefiles.
It will be useful to maintain the same build system while compiling on Windows
too.  One approach is to compile Open vSwitch in a MinGW environment that
contains autoconf and automake utilities and then use Visual C++ as a compiler
and linker.

The following explains the steps in some detail.
* Install Mingw on a Windows machine by following the instructions at:
http://www.mingw.org/wiki/Getting_Started

This should install mingw at C:\Mingw and msys at C:\Mingw\msys.
Add "C:\MinGW\bin" and "C:\Mingw\msys\1.0\bin" to PATH environment variable
of Windows.

You can either use the MinGW installer or the command line utility 'mingw-get'
to install both the base packages and additional packages like automake and
autoconf(version 2.68).

* Install the latest Python 2.x from python.org and verify that its path is
part of Windows' PATH environment variable.

* It is important to get the Visual Studio related environment variables and
to have the $PATH inside the bash to point to the proper compiler and linker.
One easy way to achieve this is to get into the "Developer Command prompt for
visual studio" and through it enter into the bash shell available from msys.

If after the above step, a 'which link' inside MSYS's bash says,
"/bin/link.exe", rename /bin/link.exe to something else so that the
Visual studio's linker is used.

* For pthread support, install the library, dll and includes of pthreads-win32
project from
ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release to a
directory (e.g.: C:/pthread).

* Get the Open vSwitch sources from either cloning the repo using git
or from a distribution tar ball.

* If you pulled the sources directly from an Open vSwitch Git tree,
  run boot.sh in the top source directory:

  % ./boot.sh

* In the top source directory, configure the package by running the
  configure script.  You should provide some configure options to choose
  the right compiler, linker, libraries, Open vSwitch component installation
  directories, etc. For example,

  % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
    --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
    --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread"

* Run make for the ported executables in the top source directory, e.g.:

  % make lib/vswitch-idl.h lib/vtep-idl.h ofproto/ipfix-entities.def
  % make ovsdb/ovsdb-server.exe ovsdb/ovsdb-tool.exe ovsdb/ovsdb-client.exe \
         utilities/ovs-vsctl.exe utilities/ovs-ofctl.exe \
         utilities/ovs-dpctl.exe vswitchd/ovs-vswitchd.exe \
         utilities/ovs-appctl.exe

OpenSSL, Open vSwitch and Visual C++
------------------------------------
To get SSL support for Open vSwitch on Windows, do the following:

* Install OpenSSL for Windows as suggested at
http://www.openssl.org/related/binaries.html.
The link as of this writing suggests to download it from
http://slproweb.com/products/Win32OpenSSL.html and the latest version is
"Win32 OpenSSL v1.0.1f".

Note down the directory where OpenSSL is installed (e.g.: C:/OpenSSL-Win32).

* While configuring the package, specify the OpenSSL directory path.
For example,

  % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32 ..." \
  --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
  --sysconfdir="C:/openvswitch/etc" --enable-ssl \
  --with-openssl="C:/OpenSSL-Win32"

* Run make for the ported executables.