DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Matan Azrad <matan@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson
Date: Wed, 29 Jan 2020 15:37:51 +0000	[thread overview]
Message-ID: <20200129153751.GA375@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20200127154402.4008069-3-thomas@monjalon.net>

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 <thomas@monjalon.net>
> ---
>  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


  reply	other threads:[~2020-01-29 15:37 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16  7:16 [dpdk-dev] [PATCH 0/3] add static ibverbs in meson Thomas Monjalon
2020-01-16  7:16 ` [dpdk-dev] [PATCH 1/3] buildtools: rework static pkg-config script Thomas Monjalon
2020-01-16  7:16 ` [dpdk-dev] [PATCH 2/3] build: allow to hide dependencies from pkg-config Thomas Monjalon
2020-01-17 17:34   ` Bruce Richardson
2020-01-16  7:16 ` [dpdk-dev] [PATCH 3/3] net/mlx: support static ibverbs linkage with meson Thomas Monjalon
2020-01-27 15:43 ` [dpdk-dev] [PATCH v2 0/4] add static ibverbs in meson Thomas Monjalon
2020-01-27 15:43   ` [dpdk-dev] [PATCH v2 1/4] net/mlx: add static ibverbs linkage with meson Thomas Monjalon
2020-01-27 15:44   ` [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson Thomas Monjalon
2020-01-29 15:37     ` Bruce Richardson [this message]
2020-01-29 17:48       ` Thomas Monjalon
2020-01-29 17:50         ` Bruce Richardson
2020-01-29 18:49           ` Thomas Monjalon
2020-01-29 17:48       ` Bruce Richardson
2020-01-27 15:44   ` [dpdk-dev] [PATCH v2 3/4] build: allow hiding dependencies from pkg-config Thomas Monjalon
2020-01-27 15:44   ` [dpdk-dev] [PATCH v2 4/4] net/mlx: workaround static linkage with meson Thomas Monjalon
2020-02-04 11:48   ` [dpdk-dev] [PATCH v2 0/4] add static ibverbs in meson Bruce Richardson
2020-02-04 14:27     ` Thomas Monjalon
2020-02-04 14:33       ` Bruce Richardson
2020-02-04 15:14         ` Thomas Monjalon
2020-02-04 15:20           ` Bruce Richardson
2020-02-11  1:19   ` [dpdk-dev] [PATCH v3 0/5] mlx ibverbs linking " Thomas Monjalon
2020-02-11  1:19     ` [dpdk-dev] [PATCH v3 1/5] net/mlx: add static ibverbs linkage with meson Thomas Monjalon
2020-02-11  1:19     ` [dpdk-dev] [PATCH v3 2/5] buildtools: get static mlx dependencies for meson Thomas Monjalon
2020-02-11  1:19     ` [dpdk-dev] [PATCH v3 3/5] net/mlx: workaround static linkage with meson Thomas Monjalon
2020-02-11 11:29       ` Bruce Richardson
2020-02-11 11:36         ` Thomas Monjalon
2020-02-11 11:43           ` Bruce Richardson
2020-02-11  1:19     ` [dpdk-dev] [PATCH v3 4/5] net/mlx: rename meson variable for dlopen option Thomas Monjalon
2020-02-11  1:19     ` [dpdk-dev] [PATCH v3 5/5] net/mlx: fix overlinking with meson and glue dlopen Thomas Monjalon
2020-02-11 11:32       ` Bruce Richardson
2020-02-11 11:34         ` Thomas Monjalon
2020-02-11 11:33     ` [dpdk-dev] [PATCH v3 0/5] mlx ibverbs linking in meson Bruce Richardson
2020-02-12  1:59 ` [dpdk-dev] [PATCH v4 0/6] " Thomas Monjalon
2020-02-12  1:59   ` [dpdk-dev] [PATCH v4 1/6] drivers: cleanup meson build variable Thomas Monjalon
2020-02-12  9:26     ` Xu, Rosen
2020-02-12  9:32       ` Thomas Monjalon
2020-02-12 15:04         ` [dpdk-dev] [dpdklab] " Jeremy Plsek
2020-02-12 15:18           ` Jeremy Plsek
2020-02-12 16:30             ` Thomas Monjalon
2020-02-12 16:36               ` Jeremy Plsek
2020-02-12 16:42                 ` Thomas Monjalon
2020-02-12 16:46                   ` Jeremy Plsek
2020-02-12 17:38                     ` Thomas Monjalon
2020-02-12 18:03                       ` Jeremy Plsek
2020-02-12  1:59   ` [dpdk-dev] [PATCH v4 2/6] net/mlx: add static ibverbs linkage with meson Thomas Monjalon
2020-02-12  1:59   ` [dpdk-dev] [PATCH v4 3/6] buildtools: get static mlx dependencies for meson Thomas Monjalon
2020-02-12  1:59   ` [dpdk-dev] [PATCH v4 4/6] net/mlx: workaround static linkage with meson Thomas Monjalon
2020-02-12  1:59   ` [dpdk-dev] [PATCH v4 5/6] net/mlx: rename meson variable for dlopen option Thomas Monjalon
2020-02-12  1:59   ` [dpdk-dev] [PATCH v4 6/6] net/mlx: fix overlinking with meson and glue dlopen Thomas Monjalon
2020-02-12  2:08   ` [dpdk-dev] [PATCH v4 0/6] mlx ibverbs linking in meson Thomas Monjalon
2020-02-12 22:07 ` [dpdk-dev] [PATCH v5 " Thomas Monjalon
2020-02-12 22:07   ` [dpdk-dev] [PATCH v5 1/6] drivers: cleanup meson build variable Thomas Monjalon
2020-02-13  0:25     ` Xu, Rosen
2020-02-12 22:07   ` [dpdk-dev] [PATCH v5 2/6] net/mlx: add static ibverbs linkage with meson Thomas Monjalon
2020-02-12 22:07   ` [dpdk-dev] [PATCH v5 3/6] buildtools: get static mlx dependencies for meson Thomas Monjalon
2020-02-12 22:07   ` [dpdk-dev] [PATCH v5 4/6] net/mlx: workaround static linkage with meson Thomas Monjalon
2020-02-12 22:07   ` [dpdk-dev] [PATCH v5 5/6] net/mlx: rename meson variable for dlopen option Thomas Monjalon
2020-02-12 22:07   ` [dpdk-dev] [PATCH v5 6/6] net/mlx: fix overlinking with meson and glue dlopen Thomas Monjalon
2020-02-13 13:57   ` [dpdk-dev] [PATCH v5 0/6] mlx ibverbs linking in meson Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200129153751.GA375@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).