docs: convert plugins doc md->rst
[vpp.git] / docs / developer / build-run-debug / building.rst
1 .. _building:
2
3 .. toctree::
4
5 Building VPP
6 ============
7
8 To get started developing with VPP, you need to get the required VPP sources and then build the packages.
9 For more detailed information on the build system please refer to :ref:`buildsystem`.
10
11 .. _setupproxies:
12
13 Set up Proxies
14 --------------------------
15
16 Depending on the environment you are operating in, proxies may need to be set.
17 Run these proxy commands to specify the *proxy-server-name* and corresponding *port-number*:
18
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
25 Get the VPP Sources
26 -----------------------------------
27
28 To get the VPP sources that are used to create the build, run the following commands:
29
30 .. code-block:: console
31
32     $ git clone https://gerrit.fd.io/r/vpp
33     $ cd vpp
34
35 Build VPP Dependencies
36 --------------------------------------
37
38 Before building a VPP image, make sure there are no FD.io VPP or DPDK packages
39 installed, by entering the following commands:
40
41 .. code-block:: console
42
43     $ dpkg -l | grep vpp
44     $ dpkg -l | grep DPDK
45
46 There should be no output, or no packages shown after the above commands are run.
47
48 Run the following **make** command to install the dependencies for FD.io VPP.
49
50 If the download hangs at any point, then you may need to
51 :ref:`set up proxies <setupproxies>` for the download to work.
52
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
77 Build VPP (Debug)
78 ----------------------------
79
80 This 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
82 debug images, can be found in /build-root/vpp_debug-native.
83
84 The Debug build version contains debug symbols, which are useful for troubleshooting
85 or modifying VPP. The **make** command below, builds a debug version of VPP. The
86 binaries used for building the debug image can be found in */build-root/vpp_debug-native*.
87
88 .. 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
109 Build VPP (Release Version)
110 -----------------------------------------
111
112 This section describes how to build the regular release version of FD.io VPP. The
113 release build is optimized and does not create any debug symbols.
114 The binaries used in building the release images are found in */build-root/vpp-native*.
115
116 Use the following **make** command below to build the release version of FD.io VPP.
117
118 .. code-block:: console
119
120     $ make build-release
121
122
123 Building Necessary Packages
124 --------------------------------------------
125
126 The 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
133 Building Debian Packages
134 ^^^^^^^^^^^^^^^^^^^^^^^^^
135
136 To build the debian packages, use the following command:
137
138 .. code-block:: console
139
140     $ make pkg-deb
141
142 .. _rpmpackages:
143
144 Building RPM Packages
145 ^^^^^^^^^^^^^^^^^^^^^^^
146
147 To build the rpm packages, use one of the following commands below, depending on the system:
148
149 .. code-block:: console
150
151     $ make pkg-rpm
152
153 Once the packages are built they can be found in the build-root directory.
154
155 .. code-block:: console
156
157     $ ls *.deb
158
159     If the packages are built correctly, then this should be the corresponding output:
160
161     vpp_18.07-rc0~456-gb361076_amd64.deb             vpp-dbg_18.07-rc0~456-gb361076_amd64.deb
162     vpp-dev_18.07-rc0~456-gb361076_amd64.deb         vpp-api-lua_18.07-rc0~456-gb361076_amd64.deb
163     vpp-lib_18.07-rc0~456-gb361076_amd64.deb         vpp-api-python_18.07-rc0~456-gb361076_amd64.deb
164     vpp-plugins_18.07-rc0~456-gb361076_amd64.deb
165
166 Finally, the created packages can be installed using the following commands. Install
167 the package that corresponds to OS that VPP will be running on:
168
169 For Ubuntu:
170
171 .. code-block:: console
172
173    $ sudo bash
174    # dpkg -i *.deb
175
176 For Centos or Redhat:
177
178 .. code-block:: console
179
180    $ sudo bash
181    # rpm -ivh *.rpm