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 4BAF6A052F; Wed, 29 Jan 2020 16:37:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2C8611BFDC; Wed, 29 Jan 2020 16:37:58 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 26C6B1BFD4 for ; Wed, 29 Jan 2020 16:37:56 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 07:37:56 -0800 X-IronPort-AV: E=Sophos;i="5.70,378,1574150400"; d="scan'208";a="222486281" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.97]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Jan 2020 07:37:54 -0800 Date: Wed, 29 Jan 2020 15:37:51 +0000 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Message-ID: <20200129153751.GA375@bricha3-MOBL.ger.corp.intel.com> References: <20200116071656.1663967-1-thomas@monjalon.net> <20200127154402.4008069-1-thomas@monjalon.net> <20200127154402.4008069-3-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200127154402.4008069-3-thomas@monjalon.net> User-Agent: Mutt/1.12.1 (2019-06-15) Subject: Re: [dpdk-dev] [PATCH v2 2/4] 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" On Mon, Jan 27, 2020 at 04:44:00PM +0100, Thomas Monjalon wrote: > 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 move the main library file > (libiverbs.a) at the end of the list of dependencies. > It fixes some undefined references when linking a static application > using libdpdk.pc. > > Signed-off-by: Thomas Monjalon > --- > buildtools/options-ibverbs-static.sh | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/buildtools/options-ibverbs-static.sh b/buildtools/options-ibverbs-static.sh > index 0f285a343b..43578a37f3 100755 > --- a/buildtools/options-ibverbs-static.sh > +++ b/buildtools/options-ibverbs-static.sh > @@ -9,6 +9,12 @@ > # > # 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 > + sed "/$lib/d" # move main lib at the end > +echo -l:$lib.a To improve my understanding of the desired end result with this patchset applied, I tried running different build configs with make with this patch applied. I get a build error on my system with the following settings adjusted from default (i.e. shared build with static link of ibverbs): diff .config.orig .config 32c32 < CONFIG_RTE_BUILD_SHARED_LIB=n --- > CONFIG_RTE_BUILD_SHARED_LIB=y 219c219 < CONFIG_RTE_LIBRTE_MLX5_PMD=n --- > CONFIG_RTE_LIBRTE_MLX5_PMD=y 225c225 < CONFIG_RTE_IBVERBS_LINK_STATIC=n --- > CONFIG_RTE_IBVERBS_LINK_STATIC=y Error message I got is below. This is on Ubuntu 19.10 with gcc 9.2: LD librte_pmd_mlx5.so.20.0.1 /usr/bin/ld: /lib/x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocation R_X86_64_PC32 against symbol `stderr@@GL /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[5]: *** [/home/bruce/dpdk.org/mk/rte.lib.mk:100: librte_pmd_mlx5.so.20.0.1] Error 1 make[4]: *** [/home/bruce/dpdk.org/mk/rte.subdir.mk:35: mlx5] Error 2 make[3]: *** [/home/bruce/dpdk.org/mk/rte.subdir.mk:35: net] Error 2 make[2]: *** [/home/bruce/dpdk.org/mk/rte.sdkbuild.mk:48: drivers] Error 2 make[1]: *** [/home/bruce/dpdk.org/mk/rte.sdkroot.mk:99: all] Error 2 make: *** [Makefile:12: all] Error 2