15754b53cb9005b247686d3e085f37c56a1a5fd6
[vpp.git] / docs / gettingstarted / developers / 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 sources and build the packages.
9 For more 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, proxies may need to be set. 
17 You may run these commands:
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, make sure there are no FD.io VPP or DPDK packages installed by entering the following
39 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 packages showing after each of the above commands.
47
48 Run the following **make** command to install the dependencies for FD.io VPP. 
49 If it hangs at any point during the download, then you may need to set up
50 :ref:`proxies for this to work <setupproxies>`.
51
52 .. code-block:: console
53
54     $ make install-dep
55     Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
56     Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
57     Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
58     Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
59     Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [803 kB]
60     Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [732 kB]
61     ...
62     ...
63     Update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
64     Setting up default-jdk-headless (2:1.8-56ubuntu2) ...
65     Processing triggers for libc-bin (2.23-0ubuntu3) ...
66     Processing triggers for systemd (229-4ubuntu6) ...
67     Processing triggers for ureadahead (0.100.0-19) ...
68     Processing triggers for ca-certificates (20160104ubuntu1) ...
69     Updating certificates in /etc/ssl/certs...
70     0 added, 0 removed; done.
71     Running hooks in /etc/ca-certificates/update.d...
72
73     done.
74     done.
75
76 Build VPP (Debug)
77 ----------------------------
78
79 This build version contains debug symbols which are useful for modifying VPP. The
80 **make** command below builds a debug version of VPP. The binaries, when building the
81 debug images, can be found in /build-root/vpp_debug-native.
82
83 .. code-block:: console
84
85     $ make build
86     make[1]: Entering directory '/home/vagrant/vpp-master/build-root'
87     @@@@ Arch for platform 'vpp' is native @@@@
88     @@@@ Finding source for dpdk @@@@
89     @@@@ Makefile fragment found in /home/vagrant/vpp-master/build-data/packages/dpdk.mk @@@@
90     @@@@ Source found in /home/vagrant/vpp-master/dpdk @@@@
91     @@@@ Arch for platform 'vpp' is native @@@@
92     @@@@ Finding source for vpp @@@@
93     @@@@ Makefile fragment found in /home/vagrant/vpp-master/build-data/packages/vpp.mk @@@@
94     @@@@ Source found in /home/vagrant/vpp-master/src @@@@
95     ...
96     ...
97     make[5]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp/vpp-api/java'
98     make[4]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp/vpp-api/java'
99     make[3]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp'
100     make[2]: Leaving directory '/home/vagrant/vpp-master/build-root/build-vpp_debug-native/vpp'
101     @@@@ Installing vpp: nothing to do @@@@
102     make[1]: Leaving directory '/home/vagrant/vpp-master/build-root'
103
104 Build VPP (Release Version)
105 -----------------------------------------
106
107 To build the release version of FD.io VPP. This build is optimized and will not create debug symbols.
108 The binaries when building the release images can be found in /build-root/vpp-native.
109
110 Use the following **make** command below to build the release version of FD.io VPP. This build is
111 optimized and will not create debug symbols. When building the release images, the binaries can
112 be found in /build-root/vpp-native.
113
114 .. code-block:: console
115
116     $ make build-release
117
118
119 Building Necessary Packages
120 --------------------------------------------
121
122 Building Debian Packages
123 ^^^^^^^^^^^^^^^^^^^^^^^^^
124
125 To build the debian packages, use one of the following commands below, depending on the system:
126
127 .. code-block:: console
128
129     $ make pkg-deb 
130
131 Building RPM Packages
132 ^^^^^^^^^^^^^^^^^^^^^^^
133
134 To build the rpm packages, use one of the following commands below, depending on the system:
135
136 .. code-block:: console
137
138     $ make pkg-rpm
139
140 Once the packages are builty they can be found in the build-root directory.
141
142 .. code-block:: console
143     
144     $ ls *.deb
145
146     If packages built correctly, this should be the Output
147
148     vpp_18.07-rc0~456-gb361076_amd64.deb             vpp-dbg_18.07-rc0~456-gb361076_amd64.deb
149     vpp-api-java_18.07-rc0~456-gb361076_amd64.deb    vpp-dev_18.07-rc0~456-gb361076_amd64.deb
150     vpp-api-lua_18.07-rc0~456-gb361076_amd64.deb     vpp-lib_18.07-rc0~456-gb361076_amd64.deb
151     vpp-api-python_18.07-rc0~456-gb361076_amd64.deb  vpp-plugins_18.07-rc0~456-gb361076_amd64.deb
152
153 Finally, the packages can be installed with the following:
154
155 For Ubuntu:
156
157 .. code-block:: console
158
159    $ sudo bash
160    # dpkg -i *.deb
161
162 For Centos or Redhat:
163
164 .. code-block:: console
165
166    $ sudo bash
167    # rpm -ivh *.rpm