* [dpdk-users] how to add own header files when compiling
@ 2019-03-12 3:57 曾懷恩
0 siblings, 0 replies; only message in thread
From: 曾懷恩 @ 2019-03-12 3:57 UTC (permalink / raw)
To: users
Hi,
I am new to DPDK
I have two questions when I develop my project
first is i have a large project and wants to link my pre-compiled static libraries and my code to another code which call rte_ functions
the source code tree looks like
--main.c
foo.c
foo.h
dpdk_foo.c
--com_util/xxx.c
xxx.h
ooo.c
ooo.h
libcom_util.a
so i modify my makefile and dpdk example makefile to
######################################
# Set variable
######################################
INCLUDE += -I. -I./com_util
CFLAGS += $(INCLUDE) -Wall -fPIC -g -std=c99 -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
SUBDIRS := com_util dpdk
APP = pppoeclient
# all source are stored in SRCS-y
SRCS-y := pppd.c sock.c fsm.c codec.c dpdk_send.c
# Build using pkg-config variables if possible
$(shell pkg-config --exists libdpdk)
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
# Default target, can be overridden by command line or environment
RTE_TARGET ?= x86_64-native-linuxapp-gcc
include $(RTE_SDK)/mk/rte.vars.mk
OBJ += $(SRC:.c=.o)
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -L./com_util -lcom_util
include $(RTE_SDK)/mk/rte.app.mk
##########################################
assume that libcom_util.a is pre-compiled
when i make, but it returns can’t find include header I defined in com_util directory
is there any solution that can include header files in dpdk foramt makefile?
and the second question is like above but only assuming libcom_util.a is not pre-compiled
how do I make makefile to compile sub-directory source code to library in dpdk format makefile
my original makefile without dpdk_foo.c is
CC = gcc -g
INCLUDE = -I. -I./com_util
CFLAGS = $(INCLUDE) -Wall -fPIC -g -std=c99 -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
TARGET = pppoeclient
SRC = pppd.c sock.c fsm.c codec.c
OBJ = $(SRC:.c=.o)
SUBDIRS := com_util
######################################
# Compile & Link
# Must use \tab key after new line
######################################
$(TARGET): $(OBJ) *.h
for dir in $(SUBDIRS); \
do make -C $$dir all || exit 1; \
done
$(CC) $(OBJ) $(CFLAGS) -L./com_util -o $(TARGET) \
-static -lcom_util
######################################
# Clean
######################################
clean:
@for dir in $(SUBDIRS); do make -C $$dir clean|| exit 1; done
rm -f *.o $(TARGET)
I have tried to just add rte_ library I need and --whole-archive tag to my original makefile
It can be compiled successfully but fail in execution time when call rte_pktmbuf_pool_create(); function (return “error setting mempool handler")
could anyone solve my questions please?
many thanks,
best regards,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-14 21:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 3:57 [dpdk-users] how to add own header files when compiling 曾懷恩
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).