I always forget how to install DPDK correctly… Let’s take some notes.
- 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.
Get your version at the download page. Let’s say that we place it in a
wget https://wget https://fast.dpdk.org/rel/dpdk-xx.yy.tar.xz
tar xJf dpdk-xx.yy.tar.xz cd dpdk-xx.yy
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.
To compile the sources and install them, we use
ninja install -j CORES
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.
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
The programs like
testpmd are in
~/sw/dpdk-xx.yy/install/bin/. You’ll probably find your program named
For linking in other applications
Check which version are you getting with
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:
You can obtain the gcc flags for linking with:
pkg-config --cflags libdpdk