blob: 37dacf1e2da1268278e7226dea4fa58729226656 [file] [log] [blame]
John DeNisco06dcd452018-07-26 12:45:10 -04001.. _building:
2
3.. toctree::
4
5Building VPP
6============
7
John DeNisco2ba9dcf2018-08-23 14:04:22 -04008To get started developing with VPP, you need to get the required VPP sources and then build the packages.
9For more detailed information on the build system please refer to :ref:`buildsystem`.
John DeNisco06dcd452018-07-26 12:45:10 -040010
11.. _setupproxies:
12
13Set up Proxies
andrewa38d0012018-08-06 00:25:33 -040014--------------------------
John DeNisco06dcd452018-07-26 12:45:10 -040015
John DeNisco2ba9dcf2018-08-23 14:04:22 -040016Depending on the environment you are operating in, proxies may need to be set.
17Run these proxy commands to specify the *proxy-server-name* and corresponding *port-number*:
John DeNisco06dcd452018-07-26 12:45:10 -040018
19.. code-block:: console
20
21 $ export http_proxy=http://<proxy-server-name>.com:<port-number>
22 $ export https_proxy=https://<proxy-server-name>.com:<port-number>
23
24
25Get the VPP Sources
andrewa38d0012018-08-06 00:25:33 -040026-----------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -040027
John DeNiscoce96dda2018-08-14 16:04:09 -040028To get the VPP sources that are used to create the build, run the following commands:
John DeNisco06dcd452018-07-26 12:45:10 -040029
30.. code-block:: console
31
32 $ git clone https://gerrit.fd.io/r/vpp
33 $ cd vpp
34
35Build VPP Dependencies
andrewa38d0012018-08-06 00:25:33 -040036--------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -040037
John DeNisco2ba9dcf2018-08-23 14:04:22 -040038Before building a VPP image, make sure there are no FD.io VPP or DPDK packages
39installed, by entering the following commands:
John DeNisco06dcd452018-07-26 12:45:10 -040040
41.. code-block:: console
42
43 $ dpkg -l | grep vpp
44 $ dpkg -l | grep DPDK
45
John DeNisco2ba9dcf2018-08-23 14:04:22 -040046There should be no output, or no packages shown after the above commands are run.
John DeNisco06dcd452018-07-26 12:45:10 -040047
John DeNiscoce96dda2018-08-14 16:04:09 -040048Run the following **make** command to install the dependencies for FD.io VPP.
John DeNisco2ba9dcf2018-08-23 14:04:22 -040049
50If the download hangs at any point, then you may need to
51:ref:`set up proxies <setupproxies>` for the download to work.
John DeNisco06dcd452018-07-26 12:45:10 -040052
53.. code-block:: console
54
55 $ make install-dep
56 Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
57 Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
58 Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
59 Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
60 Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [803 kB]
61 Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [732 kB]
62 ...
63 ...
64 Update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
65 Setting up default-jdk-headless (2:1.8-56ubuntu2) ...
66 Processing triggers for libc-bin (2.23-0ubuntu3) ...
67 Processing triggers for systemd (229-4ubuntu6) ...
68 Processing triggers for ureadahead (0.100.0-19) ...
69 Processing triggers for ca-certificates (20160104ubuntu1) ...
70 Updating certificates in /etc/ssl/certs...
71 0 added, 0 removed; done.
72 Running hooks in /etc/ca-certificates/update.d...
73
74 done.
75 done.
76
andrewa38d0012018-08-06 00:25:33 -040077Build VPP (Debug)
78----------------------------
John DeNisco06dcd452018-07-26 12:45:10 -040079
John DeNiscoce96dda2018-08-14 16:04:09 -040080This build version contains debug symbols which are useful for modifying VPP. The
81**make** command below builds a debug version of VPP. The binaries, when building the
82debug images, can be found in /build-root/vpp_debug-native.
John DeNisco06dcd452018-07-26 12:45:10 -040083
John DeNisco2ba9dcf2018-08-23 14:04:22 -040084The Debug build version contains debug symbols, which are useful for troubleshooting
85or modifying VPP. The **make** command below, builds a debug version of VPP. The
86binaries used for building the debug image can be found in */build-root/vpp_debug-native*.
87
John DeNisco06dcd452018-07-26 12:45:10 -040088.. code-block:: console
89
90 $ make build
91 make[1]: Entering directory '/home/vagrant/vpp-master/build-root'
92 @@@@ Arch for platform 'vpp' is native @@@@
93 @@@@ Finding source for dpdk @@@@
94 @@@@ Makefile fragment found in /home/vagrant/vpp-master/build-data/packages/dpdk.mk @@@@
95 @@@@ Source found in /home/vagrant/vpp-master/dpdk @@@@
96 @@@@ Arch for platform 'vpp' is native @@@@
97 @@@@ Finding source for vpp @@@@
98 @@@@ Makefile fragment found in /home/vagrant/vpp-master/build-data/packages/vpp.mk @@@@
99 @@@@ Source found in /home/vagrant/vpp-master/src @@@@
100 ...
101 ...
102 make[5]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp/vpp-api/java'
103 make[4]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp/vpp-api/java'
104 make[3]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp'
105 make[2]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp'
106 @@@@ Installing vpp: nothing to do @@@@
107 make[1]: Leaving directory '/home/vagrant/vpp-master/build-root'
108
109Build VPP (Release Version)
andrewa38d0012018-08-06 00:25:33 -0400110-----------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400111
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400112This section describes how to build the regular release version of FD.io VPP. The
113release build is optimized and does not create any debug symbols.
114The binaries used in building the release images are found in */build-root/vpp-native*.
John DeNisco06dcd452018-07-26 12:45:10 -0400115
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400116Use the following **make** command below to build the release version of FD.io VPP.
John DeNiscoce96dda2018-08-14 16:04:09 -0400117
John DeNisco06dcd452018-07-26 12:45:10 -0400118.. code-block:: console
119
andrewa38d0012018-08-06 00:25:33 -0400120 $ make build-release
John DeNisco06dcd452018-07-26 12:45:10 -0400121
122
123Building Necessary Packages
andrewa38d0012018-08-06 00:25:33 -0400124--------------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400125
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400126The package that needs to be built depends on the type system VPP will be running on:
127
128* The :ref:`Debian package <debianpackages>` is built if VPP is going to run on Ubuntu
129* The :ref:`RPM package <rpmpackages>` is built if VPP is going to run on Centos or Redhat
130
131.. _debianpackages:
132
John DeNisco06dcd452018-07-26 12:45:10 -0400133Building Debian Packages
andrewa38d0012018-08-06 00:25:33 -0400134^^^^^^^^^^^^^^^^^^^^^^^^^
John DeNisco06dcd452018-07-26 12:45:10 -0400135
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400136To build the debian packages, use the following command:
John DeNiscoce96dda2018-08-14 16:04:09 -0400137
John DeNisco06dcd452018-07-26 12:45:10 -0400138.. code-block:: console
139
140 $ make pkg-deb
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400141
142.. _rpmpackages:
John DeNisco06dcd452018-07-26 12:45:10 -0400143
John DeNisco06dcd452018-07-26 12:45:10 -0400144Building RPM Packages
andrewa38d0012018-08-06 00:25:33 -0400145^^^^^^^^^^^^^^^^^^^^^^^
John DeNisco06dcd452018-07-26 12:45:10 -0400146
John DeNiscoce96dda2018-08-14 16:04:09 -0400147To build the rpm packages, use one of the following commands below, depending on the system:
148
John DeNisco06dcd452018-07-26 12:45:10 -0400149.. code-block:: console
150
151 $ make pkg-rpm
152
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400153Once the packages are built they can be found in the build-root directory.
John DeNisco06dcd452018-07-26 12:45:10 -0400154
155.. code-block:: console
156
157 $ ls *.deb
158
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400159 If the packages are built correctly, then this should be the corresponding output:
John DeNisco06dcd452018-07-26 12:45:10 -0400160
161 vpp_18.07-rc0~456-gb361076_amd64.deb vpp-dbg_18.07-rc0~456-gb361076_amd64.deb
162 vpp-api-java_18.07-rc0~456-gb361076_amd64.deb vpp-dev_18.07-rc0~456-gb361076_amd64.deb
163 vpp-api-lua_18.07-rc0~456-gb361076_amd64.deb vpp-lib_18.07-rc0~456-gb361076_amd64.deb
164 vpp-api-python_18.07-rc0~456-gb361076_amd64.deb vpp-plugins_18.07-rc0~456-gb361076_amd64.deb
165
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400166Finally, the created packages can be installed using the following commands. Install
167the package that correspnds to OS that VPP will be running on:
andrewa38d0012018-08-06 00:25:33 -0400168
169For Ubuntu:
John DeNisco06dcd452018-07-26 12:45:10 -0400170
171.. code-block:: console
172
173 $ sudo bash
174 # dpkg -i *.deb
andrewa38d0012018-08-06 00:25:33 -0400175
176For Centos or Redhat:
177
178.. code-block:: console
179
180 $ sudo bash
181 # rpm -ivh *.rpm