From 20c11032aecc9678b415dc1861607d5f46ec34ef Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 18 Jul 2016 15:12:10 -0700 Subject: [PATCH] build: link DPDK libraries with --whole-archive The upcoming DPDK version adds objects that have no externally referenced symbols but that must be linked in (specifically, the default mempool handlers are now assigned by a constructor function). Link all of the DPDK libraries with -Wl,--whole-archive to fix linking against a static library build of DPDK. Change-Id: Ia54b100d81aa7be30a8f4bcad65cc182e91dcc65 Reported-by: Jay Sternberg Signed-off-by: Daniel Verkamp --- mk/spdk.common.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index c82af652f..c8893e063 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -161,7 +161,9 @@ DPDK_INC_DIR ?= $(DPDK_DIR_ABS)/include DPDK_LIB_DIR ?= $(DPDK_DIR_ABS)/lib DPDK_INC = -I$(DPDK_INC_DIR) -DPDK_LIB = -L$(DPDK_LIB_DIR) -Wl,--start-group -lrte_eal -lrte_mempool -lrte_ring -lrte_timer -Wl,--end-group -Wl,-rpath=$(DPDK_LIB_DIR) +DPDK_LIB = -L$(DPDK_LIB_DIR) -Wl,--start-group -Wl,--whole-archive \ + -lrte_eal -lrte_mempool -lrte_ring -lrte_timer \ + -Wl,--end-group -Wl,--no-whole-archive -Wl,-rpath=$(DPDK_LIB_DIR) # librte_malloc was removed after DPDK 2.1. Link this library conditionally based on its # existence to maintain backward compatibility. ifneq ($(wildcard $(DPDK_DIR_ABS)/lib/librte_malloc.*),)