From c093e28f494d92f71fd3ce16a8daacb0cf1715ae Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Wed, 29 Apr 2020 20:11:55 +0800 Subject: [PATCH] mk: fix static linkage of mlx dependency When building a target application with static linking mode via makefiles and enable linking to ibverbs libs by setting "CONFIG_RTE_IBVERBS_LINK_STATIC=y". The libibverbs.pc will be chosen and all the libs listed in the file will be linked by default. Some static lib archives may contain the same files and common interfaces inside. The "--no-whole-archive" needs to be enabled for the linker to discard the useless symbols and resolve the symbols redefinition error. Fixes: 2c0dd7b69fb0 ("config: add static linkage of mlx dependency") Cc: stable@dpdk.org Signed-off-by: Bing Zhao Acked-by: Thomas Monjalon --- mk/rte.app.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 244e74d883..db619c5e3f 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -209,7 +209,9 @@ ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) _LDLIBS-y += -ldl else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y) LIBS_IBVERBS_STATIC = $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh) +_LDLIBS-y += --no-whole-archive _LDLIBS-y += $(LIBS_IBVERBS_STATIC) +_LDLIBS-y += --whole-archive else ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y) _LDLIBS-y += -libverbs -lmlx5 -- 2.20.1