From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 1EA182B84 for ; Thu, 6 Apr 2017 16:48:15 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id w11so60568292wrc.3 for ; Thu, 06 Apr 2017 07:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=D2GZ4Clir4IV1wCpzoYbdamkcKwHyoLeDl+CJcD0Oz8=; b=FK9Db4DlErOCQ1Y+HliF/BEVZtSwFGJWhoEkc3XDz5a3WcqUFwSsQK0yX1JvNY9igX Jf5LdLSTUag8HbkKmGZwAl82EiQAhfkxj1Q/bLop3Niv9Mwbvk7VpPA8rhEN5+TRKsuT 7oKIOj/WpiZyGRc95hWDTukua8XfnUQy/O/jCf4pJqUpgE+bJ8CVbxqBNubrxmpB5JY3 XKk+EP80oBosUDzT9lnBXHkbQY1to5nX9wpvbTmRaQS6Gsxc7/ivktQRDOWK/fC+vHtf CaLkaRTEBCXLJarNDObW+c7Z5GlINXgY69ifuCPcKaS/MmJefeQ7/b99/izy52yDvanE KUwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=D2GZ4Clir4IV1wCpzoYbdamkcKwHyoLeDl+CJcD0Oz8=; b=HA5iylcJWIwwJi7B/gfj5TydelqxIfU9p4KsiN0YvaPCHD7XtxJLFT7FQ5B7AJXVPq 8Jhe0Eiha0dZdME7X9Q/lzdSAgiQyN7kncXc1YaQNH01snKi5pcgy2v2l9F9w3OsMxJP OD+edCjGVoYmU1druFes9+DxeufwiQN1DT2TlVEmERCOc05RYe/Rc0QvNEDX0OKC5Lkj FL9RoC042CO9AgamTjFnkaTMOFyMRleffL076Rla/4/6pJPOLZq4q11+9qEX0RYVdNtd tOjqBilt1D85lkLMWwXOrIfYhUnCfqVripfMvxCpgAQkD/vR85PTSZZk6p3vFF4ks9d8 pQKg== X-Gm-Message-State: AFeK/H1iZ7PplvSAHbDeYCzo1F/e5AGmnq96hyVCWiwUdpzrXOW0sNiN sRMeBmL31L0BDb8g X-Received: by 10.28.37.135 with SMTP id l129mr22744804wml.49.1491490093274; Thu, 06 Apr 2017 07:48:13 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id a10sm2425762wra.17.2017.04.06.07.48.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 07:48:12 -0700 (PDT) From: Thomas Monjalon To: Olivier Matz Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 06 Apr 2017 16:48:11 +0200 Message-ID: <497164429.X1217vCfaY@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20170406141455.14894-1-olivier.matz@6wind.com> References: <20170406141455.14894-1-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] mk: fix lib filtering 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: , X-List-Received-Date: Thu, 06 Apr 2017 14:48:15 -0000 2017-04-06 16:14, Olivier Matz: > 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") > > Cc: stable@dpdk.org > Signed-off-by: Olivier Matz Acked-by: Thomas Monjalon It is a really nice Makefile recursive function :) > +# 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)) Applied, thanks