From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by dpdk.org (Postfix) with ESMTP id D11442B84 for ; Thu, 6 Apr 2017 16:48:13 +0200 (CEST) Received: by mail-lf0-f42.google.com with SMTP id z15so27700137lfd.1 for ; Thu, 06 Apr 2017 07:48:13 -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=H2ojf84jfFS88QLAfYhYMU3HhKIARDWO+5M6xO54N71raD7POeNGiMXY6TclaEzfdN zo+Te8kXBVVNXrHRUzEnq5gx5GufWAr0QFxWM8gixCIAQhH7dQU6+lq1XIgsuifu0tzy A1kX6yc6wAdPY17XhUnLTPf4nL/VLJyBAtiR1A95y2V8qMceFrT2gyp65BCc6eH0rxjz cP+qUhEmk6O+sw8SONQFxnFJ0jkx7jH1EuUj1w/lXd8pLPH6S1qq+vW/iK7b1Jlh2a/d NdZC6xkLWpjZqjZ2QAA3seLYTxxsvvGnYGwjwDCzG7zz/VBv8OeEPAS3suzqWE6SwZqX KCYA== X-Gm-Message-State: AFeK/H2R91jDZ1rwp8o59k6dddoZIomXeRffAcq9vnBbbjLEUPuQqwIg kMfWTkmxTTZ5j/riIzc= 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-stable] [PATCH] mk: fix lib filtering 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: Thu, 06 Apr 2017 14:48:14 -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