New upstream version 17.11.5
[deb_dpdk.git] / doc / guides / sample_app_ug / compiling.rst
1  ..  BSD LICENSE
2      Copyright(c) 2015 Intel Corporation. All rights reserved.
3      All rights reserved.
4
5      Redistribution and use in source and binary forms, with or without
6      modification, are permitted provided that the following conditions
7      are met:
8
9      * Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11      * Redistributions in binary form must reproduce the above copyright
12      notice, this list of conditions and the following disclaimer in
13      the documentation and/or other materials provided with the
14      distribution.
15      * Neither the name of Intel Corporation nor the names of its
16      contributors may be used to endorse or promote products derived
17      from this software without specific prior written permission.
18
19      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 Compiling the Sample Applications
32 =================================
33
34 This section explains how to compile the DPDK sample applications.
35
36 To compile all the sample applications
37 --------------------------------------
38
39 Set the path to DPDK source code if its not set:
40
41     .. code-block:: console
42
43         export RTE_SDK=/path/to/rte_sdk
44
45 Go to DPDK source:
46
47     .. code-block:: console
48
49         cd $RTE_SDK
50
51 Build DPDK:
52
53    .. code-block:: console
54
55         make defconfig
56         make
57
58 Build the sample applications:
59
60    .. code-block:: console
61
62        export RTE_TARGET=build
63        make -C examples
64
65 For other possible ``RTE_TARGET`` values and additional information on
66 compiling see
67 :ref:`Compiling DPDK on Linux <linux_gsg_compiling_dpdk>` or
68 :ref:`Compiling DPDK on FreeBSD <building_from_source>`.
69 Applications are output to: ``$RTE_SDK/examples/app-dir/build`` or
70 ``$RTE_SDK/examples/app-dir/$RTE_TARGET``.
71
72
73 In the example above the compiled application is written to the ``build`` subdirectory.
74 To have the applications written to a different location,
75 the ``O=/path/to/build/directory`` option may be specified in the make command.
76
77     .. code-block:: console
78
79        make O=/tmp
80
81 To build the applications for debugging use the ``DEBUG`` option.
82 This option adds some extra flags, disables compiler optimizations and
83 sets verbose output.
84
85     .. code-block:: console
86
87        make DEBUG=1
88
89
90 To compile a single application
91 -------------------------------
92
93 Set the path to DPDK source code:
94
95     .. code-block:: console
96
97         export RTE_SDK=/path/to/rte_sdk
98
99 Go to DPDK source:
100
101     .. code-block:: console
102
103        cd $RTE_SDK
104
105 Build DPDK:
106
107     .. code-block:: console
108
109         make defconfig
110         make
111
112 Go to the sample application directory. Unless otherwise specified the sample
113 applications are located in ``$RTE_SDK/examples/``.
114
115
116 Build the application:
117
118     .. code-block:: console
119
120         export RTE_TARGET=build
121         make
122
123 To cross compile the sample application(s)
124 ------------------------------------------
125
126 For cross compiling the sample application(s), please append 'CROSS=$(CROSS_COMPILER_PREFIX)' to the 'make' command.
127 In example of AARCH64 cross compiling:
128
129     .. code-block:: console
130
131         export RTE_TARGET=build
132         export RTE_SDK=/path/to/rte_sdk
133         make -C examples CROSS=aarch64-linux-gnu-
134                or
135         make CROSS=aarch64-linux-gnu-