1. 程式人生 > 其它 >DPDK原始碼編譯與環境搭建

DPDK原始碼編譯與環境搭建

DPDK原始碼編譯與環境搭建

DPDK

一、DPDK編譯

  1. 下載原始碼,http://core.dpdk.org/download/,最好下載LTS版本,例如Latest Long Term Stable (LTS) 21.11.0。
  2. 下載依賴工具meson和ninja
    • Linux環境是Ubuntu18.04LTS,其自帶有ninja。
    • meson不可以直接使用apt-get install meson對應版本的。
  3. DPDK構建meson build
  4. 配置結束,構建並安裝DPDK系統,最後兩個命令要以root身份執行。
    cd
    build ninja ninja install ldconfig

1. meson build遇到的兩個錯誤

  1. 錯誤1:meson_options.txt:7:0: ERROR: Unknown type feature錯誤,原因是版本低,需用pip3安裝新版本的meson工具。參考連結How to fix Meson build “ERROR: Unknown Type feature” on Ubuntu 18.04
    • 解除安裝使用apt-get下載的工具,apt-get purge meson
    • sudo apt-get install python3 python3-pip
    • sudo pip3 install meson
    • 檢視meson版本,meson -v
  2. 錯誤2:buildtools/meson.build:49:8: ERROR: Problem encountered: missing python module: elftools,命令pip3 install pyelftools即可解決。參考連線:dpdk: ModuleNotFoundError: No module named 'elftools'

2. 使用pip3安裝meson後,普通使用者新增環境路徑

lzy@lzy-Virtual-Machine:~/dpdk/dpdk-21.11/build$ python3
Python 3.6.9 (default, Dec  8 2021, 21:08:43)
[GCC 8.4.0] on linux
Type "help"
, "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages'] >>>exit() lzy@lzy-Virtual-Machine:~/dpdk/dpdk-21.11/build$ cd /usr/local/lib/python3.6/dist-packages lzy@lzy-Virtual-Machine:/usr/local/lib/python3.6/dist-packages$ ls elftools meson-0.61.1.dist-info mesonbuild pyelftools-0.27.dist-info lzy@lzy-Virtual-Machine:/usr/local/lib/python3.6/dist-packages$ export PATH=/usr/local/lib/python3.6/dist-packages:$PATH lzy@lzy-Virtual-Machine:/usr/local/lib/python3.6/dist-packages$ echo $PATH /usr/local/lib/python3.6/dist-packages:/usr/local/lib/python3.6/dist-packages:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin