Centos7.9 source code compilation and installation of dpdk

  Recently I encountered a requirement, which requires compiling and installing dpdk-21.11.2 from source code on Centos7.9, and the installation directory of dpdk is /opt/. The installation process is relatively complicated, so I will record it for future reference.

Related configuration parameter
Compiler Environment Virtual machine Centos7.9
Kernel version 3.10.0-957
dpdk version 21.11.2

  DPDK is a high-performance network driver component developed by INTEL. It aims to provide a simple, convenient, complete and fast packet processing solution for data plane applications. The main technologies include user mode, polling instead of interrupts, Zero copy, network card RSS, memory access DirectIO, etc. Other information can be found on Baidu.

1. Prepare the compilation environment

1. Install relevant dependency packages.

  DPDK needs to be compiled and installed using meson and ninja after version 20.

(1) Install pip3 environment

yum install python3 python3-pip
pip3 install --upgrade pip

(2) Install meson

pip3 install meson

(3) Install ninja

pip3 install ninja

Note: If WARNING: The script ninja is installed in '/usr/local/bin' which is not on PATH. appears, you need to add environment variables. Add export PATH="/usr/local/bin:$PATH" at the end of the
vim /etc/profile

(4) Install pyelftools

pip3 install pyelftools
pip3 install ninja

2. Download the dpdk source code installation package.

Official website download link: http://core.dpdk.org/download/Download
Insert image description here the corresponding source code package of version 21.11.2, and then upload it to the specified location on the server. Here the editor uploaded it to /opt/.

2. Compile, install and test

(1) Compile and install

cd /opt/
tar zxf dpdk-stable-21.11.2.tar.gz
cd dpdk-stable-21.11.2/

export DPDK_DIR=/opt/dpdk-stable-21.11.2
export DPDK_BUILD=$DPDK_DIR/build

#查看配置
meson configure
meson build --prefix=/opt/
ninja -C build
DESTDIR=/opt/ ninja -C build install
ldconfig

export PKG_CONFIG_PATH=/opt/lib64/pkgconfig

(2) Test whether the installation is successful

After the installation is successful, enter the command and the corresponding version number information is displayed, which means the installation is successful.

pkg-config --modversion libdpdk

Insert image description here

(3) Run the test sample

Compile and run the helloworld sample:

#根据自己的安装路径去找到对应的helloworld测试样例
/opt/dpdk-stable-21.11.2/examples/helloworld  
make
./build/helloworld --no-huge 

The following picture appears indicating success.
Insert image description here

3. Common problems and solutions

1、报错:buildtools/meson.build:49:8: ERROR: Problem encountered: missing python module: elftools

Solution: pip3 install pyelftools && pip3 install ninja

2、报错: go meson_options.txt:7:0: ERROR: Unknown type feature.

Solution: pip3 install --user meson $ export PATH=~/.local/bin:$PATH

Guess you like

Origin blog.csdn.net/fish332/article/details/129119709