FastNetMon

Wednesday 29 April 2015

How to code for DPDK with C++

Hello!

If you want to code for DPDK with C++ you need some beer and half of day for digging into DPDK maillist.

Or you could use my manual and do it in seconds!

Lets' go! First of all, please download and build DPDK 2.0.0 into folder /usr/src/dpdk2.0.0

After this, please download files https://www.dropbox.com/s/hy3eisssxn2cp1f/rte.compile-pre.mk?dl=0 and https://www.dropbox.com/s/u2bkcfl35yejwx4/rte.vars.mk?dl=0 and replace files /usr/src/dpdk-2.0.0/mk/toolchain/gcc/rte.vars.mk and /usr/src/dpdk-2.0.0/mk/internal/rte.compile-pre.mk accordingly.

After this you should fix you project Makefile and rename main.c to main.cpp.

I could provide example file for you%
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif

# http://patchwork.dpdk.org/ml/archives/dev/2014-January/001127.html
CC=g++

# Default target, can be overriden by command line or environment
RTE_TARGET ?= x86_64-native-linuxapp-gcc

include $(RTE_SDK)/mk/rte.vars.mk

# binary name
APP = example

# all source are stored in SRCS-y
SRCS-y := main.cpp


CXXFLAGS += -std=gnu++11
CFLAGS += -O3
CFLAGS += -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable
LDFLAGS += -lstdc++

include $(RTE_SDK)/mk/rte.extapp.mk
My huge thanks to author of this patches http://patchwork.dpdk.org/ml/archives/dev/2014-January/001127.html :)

No comments :

Post a Comment

Note: only a member of this blog may post a comment.