From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 9729D3777 for ; Fri, 7 Apr 2017 10:15:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491552932; x=1523088932; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=XnQ8+vlPySwb5ysia+l9q2MfFTj/JnWBK0zQg6qzVUg=; b=sPvLnnGad51eIqNdhYy2a/nfEnaE1wvY71v0PcHeKnmIpPPatCZ09p5e yBY8wn4QVrKY6HNM/Sx/ONrbo8OIcw==; Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Apr 2017 01:15:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,164,1488873600"; d="scan'208";a="953273642" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2017 01:15:31 -0700 From: Yuanhan Liu To: Olivier Matz Cc: Yuanhan Liu , Thomas Monjalon , dpdk stable Date: Fri, 7 Apr 2017 16:12:00 +0800 Message-Id: <1491552724-3034-43-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1491552724-3034-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1491552724-3034-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-stable] patch 'mk: fix lib filtering when linking app' has been queued to LTS release 16.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2017 08:15:33 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 5d23520c8e6388b684b0c82fe636ee4148af7f6e Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 6 Apr 2017 16:14:55 +0200 Subject: [PATCH] mk: fix lib filtering when linking app [ upstream commit ab338eb44ebb79840dab1de2742c07070ae3bf0e ] I get the following error when linking the test application: build/lib/librte_pmd_thunderx_nicvf.a(nicvf_hw.o): In function `nicvf_qsize_regbit': drivers/net/thunderx/base/nicvf_hw.c:451: undefined reference to `log2' build/lib/librte_pmd_thunderx_nicvf.a(nicvf_hw.o): In function `nicvf_rss_reta_update': drivers/net/thunderx/base/nicvf_hw.c:804: undefined reference to `log2' build/lib/librte_pmd_thunderx_nicvf.a(nicvf_hw.o): In function `nicvf_rss_reta_query': drivers/net/thunderx/base/nicvf_hw.c:825: undefined reference to `log2' While I don't know why it does not happen for a default build, the error can be explained. The link command line is: gcc -o test ... *.o ... -Wl,-lm ... -Wl,-lrte_pmd_thunderx_nicvf ... rte_pmd_thunderx_nicvf needs the math library, and it should be added after. This is not the case because the test application also adds the math library. The makefile already filters the libraries, but it keeps the first occurrence of the lib. Instead, the last one should be kept. Fixes: edf4d331dcdb ("mk: eliminate duplicates from libraries list") Signed-off-by: Olivier Matz Acked-by: Thomas Monjalon --- mk/rte.app.mk | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index f75f0e2..725e01d 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -168,10 +168,21 @@ _LDLIBS-y += $(EXECENV_LDLIBS) LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS) -# Eliminate duplicates without sorting -LDLIBS := $(shell echo $(LDLIBS) | \ - awk '{for (i = 1; i <= NF; i++) { \ - if ($$i !~ /^-l.*/ || !seen[$$i]++) print $$i }}') +# all the words except the first one +allbutfirst = $(wordlist 2,$(words $(1)),$(1)) + +# Eliminate duplicates without sorting, only keep the last occurrence +filter-libs = \ + $(if $(1),$(strip\ + $(if \ + $(and \ + $(filter $(firstword $(1)),$(call allbutfirst,$(1))),\ + $(filter -l%,$(firstword $(1)))),\ + ,\ + $(firstword $(1))) \ + $(call filter-libs,$(call allbutfirst,$(1))))) + +LDLIBS := $(call filter-libs,$(LDLIBS)) ifeq ($(RTE_DEVEL_BUILD)$(CONFIG_RTE_BUILD_SHARED_LIB),yy) LDFLAGS += -rpath=$(RTE_SDK_BIN)/lib -- 1.9.0