Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / BUILD.Windows
1 Open vSwitch support on Windows is a work in progress.  This file describes
2 the planned build system to compile Open vSwitch on Windows.  Once the work
3 is complete, this file will be replaced by a INSTALL.Windows file.
4
5 Autoconf, Automake and Visual C++:
6 ---------------------------------
7 Open vSwitch on Linux uses autoconf and automake for generating Makefiles.
8 It will be useful to maintain the same build system while compiling on Windows
9 too.  One approach is to compile Open vSwitch in a MinGW environment that
10 contains autoconf and automake utilities and then use Visual C++ as a compiler
11 and linker.
12
13 The following explains the steps in some detail.
14 * Install Mingw on a Windows machine by following the instructions at:
15 http://www.mingw.org/wiki/Getting_Started
16
17 This should install mingw at C:\Mingw and msys at C:\Mingw\msys.
18 Add "C:\MinGW\bin" and "C:\Mingw\msys\1.0\bin" to PATH environment variable
19 of Windows.
20
21 You can either use the MinGW installer or the command line utility 'mingw-get'
22 to install both the base packages and additional packages like automake and
23 autoconf(version 2.68).
24
25 * Install the latest Python 2.x from python.org and verify that its path is
26 part of Windows' PATH environment variable.
27
28 * It is important to get the Visual Studio related environment variables and
29 to have the $PATH inside the bash to point to the proper compiler and linker.
30 One easy way to achieve this is to get into the "Developer Command prompt for
31 visual studio" and through it enter into the bash shell available from msys.
32
33 If after the above step, a 'which link' inside MSYS's bash says,
34 "/bin/link.exe", rename /bin/link.exe to something else so that the
35 Visual studio's linker is used.
36
37 * For pthread support, install the library, dll and includes of pthreads-win32
38 project from
39 ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release to a
40 directory (e.g.: C:/pthread).
41
42 * Get the Open vSwitch sources from either cloning the repo using git
43 or from a distribution tar ball.
44
45 * If you pulled the sources directly from an Open vSwitch Git tree,
46   run boot.sh in the top source directory:
47
48   % ./boot.sh
49
50 * In the top source directory, configure the package by running the
51   configure script.  You should provide some configure options to choose
52   the right compiler, linker, libraries, Open vSwitch component installation
53   directories, etc. For example,
54
55   % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
56     --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
57     --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread"
58
59 * Run make for the ported executables in the top source directory, e.g.:
60
61   % make lib/vswitch-idl.h lib/vtep-idl.h ofproto/ipfix-entities.def
62   % make ovsdb/ovsdb-server.exe ovsdb/ovsdb-tool.exe ovsdb/ovsdb-client.exe \
63          utilities/ovs-vsctl.exe utilities/ovs-ofctl.exe \
64          utilities/ovs-dpctl.exe vswitchd/ovs-vswitchd.exe \
65          utilities/ovs-appctl.exe
66
67 OpenSSL, Open vSwitch and Visual C++
68 ------------------------------------
69 To get SSL support for Open vSwitch on Windows, do the following:
70
71 * Install OpenSSL for Windows as suggested at
72 http://www.openssl.org/related/binaries.html.
73 The link as of this writing suggests to download it from
74 http://slproweb.com/products/Win32OpenSSL.html and the latest version is
75 "Win32 OpenSSL v1.0.1f".
76
77 Note down the directory where OpenSSL is installed (e.g.: C:/OpenSSL-Win32).
78
79 * While configuring the package, specify the OpenSSL directory path.
80 For example,
81
82   % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32 ..." \
83   --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
84   --sysconfdir="C:/openvswitch/etc" --enable-ssl \
85   --with-openssl="C:/OpenSSL-Win32"
86
87 * Run make for the ported executables.