From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 18ABCA00BE; Wed, 29 Apr 2020 14:12:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 15A6E1DA06; Wed, 29 Apr 2020 14:12:01 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 0A40C1DA04; Wed, 29 Apr 2020 14:12:00 +0200 (CEST) From: Bing Zhao To: thomas@monjalon.net, matan@mellanox.com Cc: dev@dpdk.org, stable@dpdk.org Date: Wed, 29 Apr 2020 20:11:55 +0800 Message-Id: <1588162315-177263-1-git-send-email-bingz@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] mk: fix linking with static ibverbs libraries X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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: 95276abaaf0a ("vdpa/mlx5: introduce Mellanox vDPA driver") Cc: matan@mellanox.com Cc: stable@dpdk.org Signed-off-by: Bing Zhao --- mk/rte.app.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 77161c7..15ef28b 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -207,7 +207,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 -- 1.8.3.1