[dpdk-dev] g++: undefined reference to

Thomas Monjalon thomas.monjalon at 6wind.com
Fri Jan 3 12:07:20 CET 2014


03/01/2014 11:48, Hamid Ramazani :
> eal_timer.c:(.text+0x42c): undefined reference to `clock_gettime'

From "man clock_gettime":
Link with -lrt (only for glibc versions before 2.17).

> 	g++ -m64 -pthread  -march=native -DRTE_MACHINE_CPUFLAG_SSE
> SE3 -I/home/hamid/dpdk/dpdk-1.5.1r1/examples/sample/build/include
> -I/home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/include
> -include
> /home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/include/rte_conf
> ig.h -O3 -W -Wall -Werror -Wmissing-declarations -Wpointer-arith
> -Wcast-align -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef
> -Wwrite-strings -Wl,-melf_x86_64 -Wl,-export-dynamic sample.cpp -o
> sample -Wl,-L/home/hamid/dpdk/dpdk-1.5.1r1/examples/sample/build/lib
> -Wl,-L/home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/lib
> -Wl,-L/home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/lib
> -Wl,-lrte_kni -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ixgbe -Wl,-lrte_mbuf
> -Wl,-lrte_cmdline -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_lpm
> -Wl,--start-group -Wl,-lethdev -Wl,-lrte_malloc -Wl,-lrte_mempool
> -Wl,-lrte_ring -Wl,-lrte_eal -Wl,-ldl -Wl,--end-group

Try CONFIG_RTE_BUILD_COMBINE_LIBS=y and -lintel_dpdk instead of all these 
libraries. You can also remove the warning options if you want.

You can also try to build your Makefile by including files like 
mk/rte.extapp.mk and defining CC=g++.
I don't exactly know what is needed for C++. Please keep us informed.


More information about the dev mailing list