Why?

I always forget how to install DPDK correctly… Let’s take some notes.

My environment:

  • Ubuntu 18.04
  • I don’t want to install it system-wide, I need different versions on the same system.
  • Intel 64-bit system

The new install method

Since some releases, DPDK has moved from Makefile to meson+ninja compilation. The (well-written) documentation at doc.dpdk.org has great pointers for all uses.

Download DPDK

Get your version at the download page. Let’s say that we place it in a ~/sw folder.

wget https://wget https://fast.dpdk.org/rel/dpdk-xx.yy.tar.xz

Extract it:

tar xJf dpdk-xx.yy.tar.xz
cd dpdk-xx.yy

Configuration

Create a build folder:

mkdir build
cd build

Create the build tree with meson (this will ask ninja to install dpdk in a install directory in the DPDK source folder):

meson --prefix $(pwd)/../install .. .

In this line, .. indicates where we have the sources, . where we want to built, and $(pwd)/../install where to place the results.

Compile

To compile the sources and install them, we use ninja:

ninja install -j CORES

Where CORES is the number of concurrent processes we want to run. More is faster, but I won’t put more than your number of CPU cores.

Debug symbols

If you need debug symbols, reconfigure with meson and recompile:

meson --prefix $(pwd)/../install .. . --buildtype=debug --reconfigure

You may also want to disable optimization:

meson --prefix $(pwd)/../install .. . --buildtype=debug --optimization 0 --reconfigure 

Then you need to re-compile.

rm -rf ../build/* ../install/*
ninja install

Probably there is a better way to force re-compilation. I just need to find it :P.

How to use it

Let’s say that you placed the dpdk source folder in /home/$USER/sw/dpdk-xx.yy.

The programs like testpmd are in ~/sw/dpdk-xx.yy/install/bin/. You’ll probably find your program named dpdk-programname.

For linking in other applications

Check which version are you getting with pkg-config: pkg-config --modversion libdpdk.

Most likely it will be your system default (if any).

You’ll have to set the PKG_CONFIG_PATH variable to your version, so the programs will know about it:

export PKG_CONFIG_PATH=/home/$USER/sw/dpdk-xx.yy/install/lib/x86_64-linux-gnu/pkgconfig

You can obtain the gcc flags for linking with:

pkg-config --cflags libdpdk