New upstream version 18.11-rc4
[deb_dpdk.git] / doc / guides / sample_app_ug / compiling.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2015 Intel Corporation.
3
4 Compiling the Sample Applications
5 =================================
6
7 This section explains how to compile the DPDK sample applications.
8
9 To compile all the sample applications
10 --------------------------------------
11
12 Set the path to DPDK source code if its not set:
13
14     .. code-block:: console
15
16         export RTE_SDK=/path/to/rte_sdk
17
18 Go to DPDK source:
19
20     .. code-block:: console
21
22         cd $RTE_SDK
23
24 Build DPDK:
25
26    .. code-block:: console
27
28         make defconfig
29         make
30
31 Build the sample applications:
32
33    .. code-block:: console
34
35        export RTE_TARGET=build
36        make -C examples
37
38 For other possible ``RTE_TARGET`` values and additional information on
39 compiling see
40 :ref:`Compiling DPDK on Linux <linux_gsg_compiling_dpdk>` or
41 :ref:`Compiling DPDK on FreeBSD <building_from_source>`.
42 Applications are output to: ``$RTE_SDK/examples/app-dir/build`` or
43 ``$RTE_SDK/examples/app-dir/$RTE_TARGET``.
44
45
46 In the example above the compiled application is written to the ``build`` subdirectory.
47 To have the applications written to a different location,
48 the ``O=/path/to/build/directory`` option may be specified in the make command.
49
50     .. code-block:: console
51
52        make O=/tmp
53
54 To build the applications for debugging use the ``DEBUG`` option.
55 This option adds some extra flags, disables compiler optimizations and
56 sets verbose output.
57
58     .. code-block:: console
59
60        make DEBUG=1
61
62
63 To compile a single application
64 -------------------------------
65
66 Set the path to DPDK source code:
67
68     .. code-block:: console
69
70         export RTE_SDK=/path/to/rte_sdk
71
72 Go to DPDK source:
73
74     .. code-block:: console
75
76        cd $RTE_SDK
77
78 Build DPDK:
79
80     .. code-block:: console
81
82         make defconfig
83         make
84
85 Go to the sample application directory. Unless otherwise specified the sample
86 applications are located in ``$RTE_SDK/examples/``.
87
88
89 Build the application:
90
91     .. code-block:: console
92
93         export RTE_TARGET=build
94         make
95
96 To cross compile the sample application(s)
97 ------------------------------------------
98
99 For cross compiling the sample application(s), please append 'CROSS=$(CROSS_COMPILER_PREFIX)' to the 'make' command.
100 In example of AARCH64 cross compiling:
101
102     .. code-block:: console
103
104         export RTE_TARGET=build
105         export RTE_SDK=/path/to/rte_sdk
106         make -C examples CROSS=aarch64-linux-gnu-
107                or
108         make CROSS=aarch64-linux-gnu-