How to Build DPDK with Intel® oneAPI DPC++/C++ Compiler on Linux

ID 772501
Updated 3/1/2023
Version 2023.0
Public

This recipe helps you build DPDK with Intel oneAPI.

Content expert:

Alina Shadrina

Prerequisites

  1. Install  Intel® oneAPI Base Toolkit which contains Intel oneAPI DPC++/C++ Compiler. Please, refer to the Get Started Guide in case of any questions. To check for supported Linux distributions and hardware requirements, please refer Intel® oneAPI DPC++/C++ Compiler System Requirements. 
  2. DPDK Framework is based on meson* system which can be installed with:
python3 -m pip install meson

           Make sure you are using meson >= 0.64 and newer because the support for Intel LLVM Compiler is added starting 0.64 release. Please, refer to Meson Quick Guide for more information about system requirements and prerequisites.

  1. Install Ninja  build system:
python3 -m pip install ninja

Building DPDK with Intel oneAPI DPC++/C++ Compiler

 

  1. Get the latest version of DPDK:
git clone  https://github.com/DPDK/dpdk.git

            Or download one of the official releases.  

  1. Navigate to DPDK project folder.
  2. If you installed meson, Ninja, and other dependencies using pip locally, update PATH with your .local/bin, i.e.:
export PATH=$PATH:/home/user/.local/bin
  1. Set up Intel oneAPI environment variables
    1. For non-default installation:
source $ONEAPI_ROOT/setvars.sh
    1. For default installation:
source /opt/intel/oneapi/setvars.sh
  1. Run meson with Intel oneAPI DPC++/C++ Compiler  to configure the project:
CC=icx CXX=icpx FC=ifx meson -Dexamples=all build

           As a result, the end of the build log will looks as follows:

The Meson build system Version: 1.0.0 Source dir: /home/dpdk Build dir: /home/dpdk/build Build type: native build Program cat found: YES (/usr/bin/cat) Project name: DPDK Project version: 23.03.0-rc0 C compiler for the host machine: icx (intel-llvm 2023.0.0 "Intel(R) oneAPI DPC++/C++ Compiler 2023.0.0 (2023.0.0.20221201)") C linker for the host machine: icx ld.bfd 2.34 ….. apps: dumpcap: missing dependency, "libpcap" libs: kni: explicitly disabled via build config (deprecated lib) flow_classify: explicitly disabled via build config (deprecated lib) drivers: common/mvep: missing dependency, "libmusdk" net/af_xdp: missing dependency, "libxdp >=1.2.2" and "libbpf" net/ipn3ke: missing dependency, "libfdt" net/kni: missing internal dependency, "kni" (deprecated lib) net/mvneta: missing dependency, "libmusdk" net/mvpp2: missing dependency, "libmusdk" net/nfb: missing dependency, "libnfb" net/pcap: missing dependency, "libpcap" raw/ifpga: missing dependency, "libfdt" crypto/armv8: missing dependency, "libAArch64crypto" crypto/ipsec_mb: missing dependency, "libIPSec_MB" crypto/mvsam: missing dependency, "libmusdk" crypto/uadk: missing dependency, "libwd" compress/isal: missing dependency, "libisal" gpu/cuda: missing dependency, "cuda.h" Build targets in project: 776 DPDK 23.03.0-rc0 User defined options examples: all Found ninja-1.10.0 at /usr/bin/ninja
  1. Run Ninja to build executables:
ninja -C build
  1. Make sure DPDK is built with Intel oneAPI DPC++/C++ Compiler:
$ readelf -p .comment build/app/test/dpdk-test String dump of section '.comment': [ 0] GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 [ 2b] Intel(R) oneAPI DPC++/C++ Compiler 2023.0.0 (2023.0.0.20221201) [ 6b] Intel(R) oneAPI DPC++/C++ Compiler 2023.0.0 (2023.0.0.20221116)

 

Troubleshooting

If you observe multiple errors:

./rte_build_config.h:422:28: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions] #define RTE_TOOLCHAIN_INTEL-LLVM 1

 Then abort compilation, open build/rte_build_config.h and replace :

#define RTE_TOOLCHAIN_INTEL-LLVM 1

With

#define RTE_TOOLCHAIN_INTEL_LLVM 1

And then rerun Ninja.