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