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 7A5C6A0530; Wed, 12 Feb 2020 03:00:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DB9841BDF8; Wed, 12 Feb 2020 02:59:58 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 07EED2BF1 for ; Wed, 12 Feb 2020 02:59:57 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AE9DC21B14; Tue, 11 Feb 2020 20:59:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 11 Feb 2020 20:59:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=H/+z4oNHkV jRmZuRiw2F6f0Sev3pNw3XncrPU3rLCjk=; b=g5z5n+LxEnN+ase/tTPz9RthmY WxHXiEtw6EEzhbUohJRCVm/iVDHYrfNCBKYRbkY95sJsg77jjVzbAL2HK8wu8r+k Cr/ObmyZAybxX1eDmrH0Q4OKP5rnslVvA6Dr+jr8zqPTXDfluK91J5XtvLi2TdPj mBZJ+gL6NgSsZCFdU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=H/+z4oNHkVjRmZuRiw2F6f0Sev3pNw3XncrPU3rLCjk=; b=HGNx9mjF /17DJf57VjrcIxmguxlCk8ylSCGb1EtoQ/lMXVAom1Lfjnm8evjiq6kTb/mXwlqa A8htlm/O5NFi6EB+SQPxGRl3nRYmlLTnNfDZue3CdRYzpxxQTvxAe312lG9iSGin e1xmfUsG+vApl+b/t9qQJ3NSAInRIw0s4gqupV82BgyPcXiJHO0IiZcy0B+/In1y iq2XG6E9436EUD5YNEaNsxZ/uDi0sAAlKJWn5y6XnZ1KnoW7+SqAWFVmiSg6gQAV UfcMEPbT9kBIdYNOdcftQnM2BL+gtDtvwIHpL4rlaqRwGYBThM+5YCDoxJP+drki hMsJFFqlvzg1pA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieeggdefgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E3108328005E; Tue, 11 Feb 2020 20:59:55 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Wed, 12 Feb 2020 02:59:41 +0100 Message-Id: <20200212015944.3037000-4-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200212015944.3037000-1-thomas@monjalon.net> References: <20200116071656.1663967-1-thomas@monjalon.net> <20200212015944.3037000-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 3/6] buildtools: get static mlx dependencies for meson 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" The shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs libraries. When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson. If linking with libraries installed in a non-standard path, an option -L is provided via EXTRA_LDFLAGS in case of using make. With meson, tuning PKG_CONFIG_PATH for pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make. The other change in this script is to drop the first occurrences of the main library file (libiverbs.a). Only the last occurrence is kept. It fixes some undefined references when linking a static application using libdpdk.pc. Signed-off-by: Thomas Monjalon --- buildtools/options-ibverbs-static.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/buildtools/options-ibverbs-static.sh b/buildtools/options-ibverbs-static.sh index 0f285a343b..0740a711ff 100755 --- a/buildtools/options-ibverbs-static.sh +++ b/buildtools/options-ibverbs-static.sh @@ -9,6 +9,13 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs | +lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + tac | + awk "/^-l:$lib.a/&&c++ {next} 1" | # drop first duplicates of main lib + tac -- 2.25.0