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 https://doc.dpdk.org/guides/linux_gsg/build_dpdk.html has great pointers for all uses.

Download DPDK

Get your version at the https://core.dpdk.org/download/. Let’s say that we place it in a ~/sw folder.

cd ~/sw
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:

meson --prefix /home/massimo/sw/dpdk-xx.yy/install .. .

In this line, .. indicates where we have the sources, . where we want to built, and /home/massimo/sw/dpdk-xx.yy/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 /home/massimo/sw/dpdk-xx.yy/install .. . --buildtype=debug --reconfigure

You may also want to disable optimization:

meson --prefix /home/massimo/sw/dpdk-xx.yy/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

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/massimo/sw/dpdk-xx.yy/install/lib/x86_64-linux-gnu/pkgconfig

You can obtain the gcc flags for linking with:

pkg-config --cflags libdpdk