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