DEV Community

pengjianzhang
pengjianzhang

Posted on

 

How to compile DPDK-22.11.1

background

DPDK is compiled with meson and ninja starting from version 20. However, installing the compilation environment is not an easy task for newcomers, which affects dperf users to use the latest DPDK version to build dperf. This article explains how to compile DPDK-22.11.1, this method can also be used to compile DPDK-20.11, DPDK-21.11.

compile method

Step 1: Install Basic Tools

yum install gcc gcc-c++ make numactl-devel git
pip3 install pyelftools
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Kernel Headers

VERSION=`uname -r`
yum install kernel-devel-$VERSION -y
Enter fullscreen mode Exit fullscreen mode

Step 3: Install meson

pip3 install meson
Enter fullscreen mode Exit fullscreen mode

Step 4: Install re2c

wget https://github.com/skvadrik/re2c/releases/download/1.0.3/re2c-1.0.3.tar.gz
tar -zxvf re2c-1.0.3.tar.gz
cd re2c-1.0.3/
./configure
make
make install
Enter fullscreen mode Exit fullscreen mode

Step 4: Install ninja

wget https://github.com/ninja-build/ninja/archive/refs/tags/v1.11.0.tar.gz
tar -zxvf v1.11.0.tar.gz
cd ninja-1.11.0/
./configure.py --bootstrap
cp ninja /usr/bin/
Enter fullscreen mode Exit fullscreen mode

Step 5: Install dpdk-22.11.1

DPDK_VERSION=22.11.1
HOME_DIR=/root/dpdk/
DPDK_XZ=dpdk-${DPDK_VERSION}.tar.xz
DPDK_TAR=dpdk-${DPDK_VERSION}.tar
DPDK_DIR=dpdk-stable-${DPDK_VERSION}

cd $HOME_DIR
wget http://fast.dpdk.org/rel/$DPDK_XZ
xz -d $DPDK_XZ
tar -xf $DPDK_TAR
cd $DPDK_DIR

# -Dbuildtype=debug
OPT_LIBS=""
expr match "${DPDK_VERSION}" "22.11." >/dev/null
if [ $? -eq 0 ]; then
     OPT_LIBS="-Ddisable_libs=\"\""
the fi
meson build --prefix=$HOME_DIR/$DPDK_DIR/mydpdk -Denable_kmods=true $OPT_LIBS

ninja -C build install
Enter fullscreen mode Exit fullscreen mode

complete script

The complete build script is in the dperf directory scripts/build_dpdk_2x.sh. Instructions:

scripts/build_dpdk_2x.sh 22.11.1
Enter fullscreen mode Exit fullscreen mode

The compilation result is in /root/dpdk/dpdk-stable-22.11.1/mydpdk.

verify

Verify that DPDK is compiled successfully by compiling dperf.

git clone https://github.com/baidu/dperf.git
cd dperf
export PKG_CONFIG_PATH=$HOME_DIR/$DPDK_DIR/mydpdk/lib64/pkgconfig
make
Enter fullscreen mode Exit fullscreen mode

Summarize

We use the scripts/build_dpdk_2x.sh script of the dperf project to install DPDK-22.11, DPDK-20.11, and DPDK-21.11 with one click. If you like it, please add a star to dperf, thank you!

Latest comments (0)