blob: d01eff7bf8ffa8ad01334293e9c918c68f79ba37 [file] [log] [blame]
John DeNisco06dcd452018-07-26 12:45:10 -04001.. _building:
2
3.. toctree::
4
5Building VPP
Saima Yunus5f6422d2022-05-19 11:48:59 -07006=====================
John DeNisco06dcd452018-07-26 12:45:10 -04007
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +02008To get started developing with VPP, you need to get the required VPP sources and then build the packages.
John DeNisco2ba9dcf2018-08-23 14:04:22 -04009For more detailed information on the build system please refer to :ref:`buildsystem`.
John DeNisco06dcd452018-07-26 12:45:10 -040010
Saima Yunus5f6422d2022-05-19 11:48:59 -070011.. _makesureinstalled:
12
13VPP for Ubuntu: Environment Setup
14-------------------------------------------
15
16If you are not downloading VPP on Ubuntu with WSL (Windows Subsystem for Linux), please disregard this section
17and jump to 'Get the VPP Sources'.
18
19Before starting on VPP for Ubuntu, make sure WSL2 and Ubuntu are installed.
20
21To install WSL2 and Ubuntu, run Windows PowerShell as an administrator and enter this in the terminal:
22
23.. code-block:: console
24
25 $ wsl --install
26
27Next, go to the 'resolv.conf' file in Ubuntu's '/etc' folder.
28It should have been automatically generated when Ubuntu was installed; if it doesn't exist, create it.
29Please use 'sudo' to avoid "File resolv.conf is unwritable" errors.
30
31.. code-block:: console
32
33 $ cd /etc
34 $ sudo nano resolv.conf
35
36In the file, add the following content in place of the current 'nameserver X.X.X.X' line:
37
38.. code-block:: console
39
40 nameserver 8.8.8.8
41
42This replaces the DNS nameserver on your machine with the Google DNS service,
43resolving any DNS Internet connection issues.
44
45Note: by default, the 'resolv.conf' file regenerates every time you restart Ubuntu, so your changes won't be saved.
46To keep your changes, run the following command to make 'resolv.conf' immutable:
47
48.. code-block:: console
49
50 $ sudo chattr +i /etc/resolv.conf
51
52
53Now copy the following lines from 'resolv.conf':
54
55.. code-block:: console
56
57 [network]
58 generateResolvConf = false
59
60Then, go to the 'wsl.conf' file in '/etc' and paste the lines there.
61Please use 'sudo' here as well to avoid "File wsl.conf is unwritable" errors.
62
63.. code-block:: console
64
65 $ sudo nano wsl.conf
66
67In order to test your DNS server connection, please ping 8.8.8.8 on the terminal:
68
69.. code-block:: console
70
71 $ ping 8.8.8.8
72 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
73 64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=9.58 ms
74 64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=45.8 ms
75 64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=9.62 ms
76 64 bytes from 8.8.8.8: icmp_seq=4 ttl=116 time=11.4 ms
77 64 bytes from 8.8.8.8: icmp_seq=5 ttl=116 time=12.2 ms
78 64 bytes from 8.8.8.8: icmp_seq=6 ttl=116 time=8.69 ms
79 64 bytes from 8.8.8.8: icmp_seq=7 ttl=116 time=52.4 ms
80 64 bytes from 8.8.8.8: icmp_seq=8 ttl=116 time=11.0 ms
81 ...
82
83While still in /etc, run the following commands:
84
85.. code-block:: console
86
87 $ sudo apt-get update
88 $ sudo apt-get dist-upgrade
89 $ sudo apt-get install --reinstall ca-certificates
90 $ sudo update-ca-certificates
91
92
93Finally, head back to your home directory and jump to 'Get the VPP Sources'.
94
John DeNisco06dcd452018-07-26 12:45:10 -040095.. _setupproxies:
96
97Set up Proxies
andrewa38d0012018-08-06 00:25:33 -040098--------------------------
John DeNisco06dcd452018-07-26 12:45:10 -040099
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200100Depending on the environment you are operating in, proxies may need to be set.
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400101Run these proxy commands to specify the *proxy-server-name* and corresponding *port-number*:
John DeNisco06dcd452018-07-26 12:45:10 -0400102
103.. code-block:: console
104
105 $ export http_proxy=http://<proxy-server-name>.com:<port-number>
106 $ export https_proxy=https://<proxy-server-name>.com:<port-number>
107
108
109Get the VPP Sources
andrewa38d0012018-08-06 00:25:33 -0400110-----------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400111
John DeNiscoce96dda2018-08-14 16:04:09 -0400112To get the VPP sources that are used to create the build, run the following commands:
John DeNisco06dcd452018-07-26 12:45:10 -0400113
114.. code-block:: console
115
116 $ git clone https://gerrit.fd.io/r/vpp
117 $ cd vpp
118
119Build VPP Dependencies
andrewa38d0012018-08-06 00:25:33 -0400120--------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400121
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400122Before building a VPP image, make sure there are no FD.io VPP or DPDK packages
123installed, by entering the following commands:
John DeNisco06dcd452018-07-26 12:45:10 -0400124
125.. code-block:: console
126
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200127 $ dpkg -l | grep vpp
John DeNisco06dcd452018-07-26 12:45:10 -0400128 $ dpkg -l | grep DPDK
129
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400130There should be no output, or no packages shown after the above commands are run.
John DeNisco06dcd452018-07-26 12:45:10 -0400131
Saima Yunus5f6422d2022-05-19 11:48:59 -0700132Please make sure **make** is installed before running the next command.
133If it is not installed, run the following command first:
134
135.. code-block:: console
136
137 $ sudo apt install make
138
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200139Run the following **make** command to install the dependencies for FD.io VPP.
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400140
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200141If the download hangs at any point, then you may need to
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400142:ref:`set up proxies <setupproxies>` for the download to work.
John DeNisco06dcd452018-07-26 12:45:10 -0400143
144.. code-block:: console
145
146 $ make install-dep
147 Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
148 Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
149 Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
150 Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
151 Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [803 kB]
152 Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [732 kB]
153 ...
154 ...
155 Update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
156 Setting up default-jdk-headless (2:1.8-56ubuntu2) ...
157 Processing triggers for libc-bin (2.23-0ubuntu3) ...
158 Processing triggers for systemd (229-4ubuntu6) ...
159 Processing triggers for ureadahead (0.100.0-19) ...
160 Processing triggers for ca-certificates (20160104ubuntu1) ...
161 Updating certificates in /etc/ssl/certs...
162 0 added, 0 removed; done.
163 Running hooks in /etc/ca-certificates/update.d...
164
165 done.
166 done.
167
andrewa38d0012018-08-06 00:25:33 -0400168Build VPP (Debug)
169----------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400170
John DeNiscoce96dda2018-08-14 16:04:09 -0400171This build version contains debug symbols which are useful for modifying VPP. The
172**make** command below builds a debug version of VPP. The binaries, when building the
173debug images, can be found in /build-root/vpp_debug-native.
John DeNisco06dcd452018-07-26 12:45:10 -0400174
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400175The Debug build version contains debug symbols, which are useful for troubleshooting
176or modifying VPP. The **make** command below, builds a debug version of VPP. The
177binaries used for building the debug image can be found in */build-root/vpp_debug-native*.
178
John DeNisco06dcd452018-07-26 12:45:10 -0400179.. code-block:: console
180
181 $ make build
182 make[1]: Entering directory '/home/vagrant/vpp-master/build-root'
183 @@@@ Arch for platform 'vpp' is native @@@@
184 @@@@ Finding source for dpdk @@@@
185 @@@@ Makefile fragment found in /home/vagrant/vpp-master/build-data/packages/dpdk.mk @@@@
186 @@@@ Source found in /home/vagrant/vpp-master/dpdk @@@@
187 @@@@ Arch for platform 'vpp' is native @@@@
188 @@@@ Finding source for vpp @@@@
189 @@@@ Makefile fragment found in /home/vagrant/vpp-master/build-data/packages/vpp.mk @@@@
190 @@@@ Source found in /home/vagrant/vpp-master/src @@@@
191 ...
192 ...
193 make[5]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp/vpp-api/java'
194 make[4]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp/vpp-api/java'
195 make[3]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp'
196 make[2]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp'
197 @@@@ Installing vpp: nothing to do @@@@
198 make[1]: Leaving directory '/home/vagrant/vpp-master/build-root'
199
200Build VPP (Release Version)
andrewa38d0012018-08-06 00:25:33 -0400201-----------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400202
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400203This section describes how to build the regular release version of FD.io VPP. The
204release build is optimized and does not create any debug symbols.
205The binaries used in building the release images are found in */build-root/vpp-native*.
John DeNisco06dcd452018-07-26 12:45:10 -0400206
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400207Use the following **make** command below to build the release version of FD.io VPP.
John DeNiscoce96dda2018-08-14 16:04:09 -0400208
John DeNisco06dcd452018-07-26 12:45:10 -0400209.. code-block:: console
210
andrewa38d0012018-08-06 00:25:33 -0400211 $ make build-release
John DeNisco06dcd452018-07-26 12:45:10 -0400212
Saima Yunus5f6422d2022-05-19 11:48:59 -0700213Installing External Dependencies
214-------------------------------------------
215At this point, there are still some VPP external dependencies left to install. They could be installed
216using 'make-build', but this only installs them locally in the VPP tree, not in the operating system.
217In order to fix this and save time, run the following command:
John DeNisco06dcd452018-07-26 12:45:10 -0400218
Saima Yunus5f6422d2022-05-19 11:48:59 -0700219.. code-block:: console
220
221 $ make install-ext-deps
222
223-------------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400224Building Necessary Packages
Saima Yunus5f6422d2022-05-19 11:48:59 -0700225-------------------------------------------
John DeNisco06dcd452018-07-26 12:45:10 -0400226
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400227The package that needs to be built depends on the type system VPP will be running on:
228
229* The :ref:`Debian package <debianpackages>` is built if VPP is going to run on Ubuntu
230* The :ref:`RPM package <rpmpackages>` is built if VPP is going to run on Centos or Redhat
231
232.. _debianpackages:
233
John DeNisco06dcd452018-07-26 12:45:10 -0400234Building Debian Packages
andrewa38d0012018-08-06 00:25:33 -0400235^^^^^^^^^^^^^^^^^^^^^^^^^
John DeNisco06dcd452018-07-26 12:45:10 -0400236
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400237To build the debian packages, use the following command:
John DeNiscoce96dda2018-08-14 16:04:09 -0400238
John DeNisco06dcd452018-07-26 12:45:10 -0400239.. code-block:: console
240
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200241 $ make pkg-deb
242
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400243.. _rpmpackages:
John DeNisco06dcd452018-07-26 12:45:10 -0400244
John DeNisco06dcd452018-07-26 12:45:10 -0400245Building RPM Packages
andrewa38d0012018-08-06 00:25:33 -0400246^^^^^^^^^^^^^^^^^^^^^^^
John DeNisco06dcd452018-07-26 12:45:10 -0400247
John DeNiscoce96dda2018-08-14 16:04:09 -0400248To build the rpm packages, use one of the following commands below, depending on the system:
249
John DeNisco06dcd452018-07-26 12:45:10 -0400250.. code-block:: console
251
252 $ make pkg-rpm
253
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400254Once the packages are built they can be found in the build-root directory.
John DeNisco06dcd452018-07-26 12:45:10 -0400255
256.. code-block:: console
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200257
John DeNisco06dcd452018-07-26 12:45:10 -0400258 $ ls *.deb
259
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400260 If the packages are built correctly, then this should be the corresponding output:
John DeNisco06dcd452018-07-26 12:45:10 -0400261
262 vpp_18.07-rc0~456-gb361076_amd64.deb vpp-dbg_18.07-rc0~456-gb361076_amd64.deb
Michal Cmarada4e633e12019-01-31 10:57:40 +0100263 vpp-dev_18.07-rc0~456-gb361076_amd64.deb vpp-api-lua_18.07-rc0~456-gb361076_amd64.deb
264 vpp-lib_18.07-rc0~456-gb361076_amd64.deb vpp-api-python_18.07-rc0~456-gb361076_amd64.deb
265 vpp-plugins_18.07-rc0~456-gb361076_amd64.deb
John DeNisco06dcd452018-07-26 12:45:10 -0400266
John DeNisco2ba9dcf2018-08-23 14:04:22 -0400267Finally, the created packages can be installed using the following commands. Install
Paul Vinciguerra7fa3dd22019-10-27 17:28:10 -0400268the package that corresponds to OS that VPP will be running on:
andrewa38d0012018-08-06 00:25:33 -0400269
270For Ubuntu:
John DeNisco06dcd452018-07-26 12:45:10 -0400271
272.. code-block:: console
273
274 $ sudo bash
275 # dpkg -i *.deb
andrewa38d0012018-08-06 00:25:33 -0400276
277For Centos or Redhat:
278
279.. code-block:: console
280
281 $ sudo bash
282 # rpm -ivh *.rpm