From 38ea764f6da631d31e3d1072a1a526c2eab6a214 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 30 Nov 2015 08:54:39 -0700 Subject: [PATCH] Conditionally add -lrte_malloc. librte_malloc has been deprecated by DPDK, but to allow for backwards compability, check for its existence and link with it if it exists. Signed-off-by: Jim Harris Change-Id: I3e05a3295b6768bd6804a8ec86c301e22040df37 --- mk/spdk.common.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index 03b0d62dc..58fade265 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -118,7 +118,13 @@ DPDK_INC_DIR ?= $(DPDK_DIR)/include DPDK_LIB_DIR ?= $(DPDK_DIR)/lib DPDK_INC = -I$(DPDK_INC_DIR) -DPDK_LIB = -L$(DPDK_LIB_DIR) -lrte_eal -lrte_malloc -lrte_mempool -lrte_ring -Wl,-rpath=$(DPDK_LIB_DIR) +DPDK_LIB = -L$(DPDK_LIB_DIR) -lrte_eal -lrte_mempool -lrte_ring -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)/lib/librte_malloc.*),) +DPDK_LIB += -lrte_malloc +endif + # DPDK requires dl library for dlopen/dlclose on Linux. ifeq ($(OS),Linux) DPDK_LIB += -ldl