DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config
@ 2020-09-01 15:58 Christian Ehrhardt
  2020-09-01 16:10 ` Christian Ehrhardt
  2020-09-01 16:16 ` Luca Boccassi
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2020-09-01 15:58 UTC (permalink / raw)
  To: dev; +Cc: Luca Boccassi, Christian Ehrhardt

The checks for libfdt try dependency() first which would only work if
a pkg-config would be present but libfdt has none.
Then it probes for the lib path itself via cc.find_library.

But later it adds the result of either probe to ext_deps which ends up
in build and also the resulting pkg-config to contain toolchain versioned
paths in Libs.private like:
  /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libfdt.so
which obviously breaks on toolchain updates.

In general libs used multiple times - ipn3ke + ifpga in this case - are
checked centrally in config/meson.build so move it there and fix the
adding of dependencies to not use the full file path.

The result is libfdt in pkg-config now showing up as:
  Libs.private: -pthread -lm -ldl -lnuma -lfdt -lpcap

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 config/meson.build             | 9 +++++++++
 drivers/net/ipn3ke/meson.build | 6 +-----
 drivers/raw/ifpga/meson.build  | 7 +------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index cff8b33dd2..1c8317e750 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -150,6 +150,15 @@ if numa_dep.found() and cc.has_header('numaif.h')
 	dpdk_extra_ldflags += '-lnuma'
 endif
 
+has_libfdt = 0
+fdt_dep = cc.find_library('libfdt', required: false)
+if fdt_dep.found() and cc.has_header('fdt.h')
+	dpdk_conf.set10('RTE_HAS_LIBFDT', true)
+	has_libfdt = 1
+	add_project_link_arguments('-lfdt', language: 'c')
+	dpdk_extra_ldflags += '-lfdt'
+endif
+
 # check for libbsd
 libbsd = dependency('libbsd', required: false)
 if libbsd.found()
diff --git a/drivers/net/ipn3ke/meson.build b/drivers/net/ipn3ke/meson.build
index ec9cb7daf0..de6e03ca65 100644
--- a/drivers/net/ipn3ke/meson.build
+++ b/drivers/net/ipn3ke/meson.build
@@ -9,11 +9,7 @@
 #  rte_eth_switch_domain_free()
 #
 
-dep = dependency('libfdt', required: false)
-if not dep.found()
-	dep = cc.find_library('libfdt', required: false)
-endif
-if not dep.found()
+if has_libnuma == 0
 	build = false
 	reason = 'missing dependency, "libfdt"'
 	subdir_done()
diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.build
index 05a1711b5d..d4a128d67e 100644
--- a/drivers/raw/ifpga/meson.build
+++ b/drivers/raw/ifpga/meson.build
@@ -1,11 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = dependency('libfdt', required: false)
-if not dep.found()
-	dep = cc.find_library('libfdt', required: false)
-endif
-if not dep.found()
+if has_libnuma == 0
 	build = false
 	reason = 'missing dependency, "libfdt"'
 	subdir_done()
@@ -16,7 +12,6 @@ objs = [base_objs]
 
 deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs',
 	'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke']
-ext_deps += dep
 
 sources = files('ifpga_rawdev.c')
 
-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config
  2020-09-01 15:58 [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config Christian Ehrhardt
@ 2020-09-01 16:10 ` Christian Ehrhardt
  2020-09-01 16:16 ` Luca Boccassi
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2020-09-01 16:10 UTC (permalink / raw)
  To: dev; +Cc: Luca Boccassi

On Tue, Sep 1, 2020 at 5:58 PM Christian Ehrhardt
<christian.ehrhardt@canonical.com> wrote:
>
> The checks for libfdt try dependency() first which would only work if
> a pkg-config would be present but libfdt has none.
> Then it probes for the lib path itself via cc.find_library.
>
> But later it adds the result of either probe to ext_deps which ends up
> in build and also the resulting pkg-config to contain toolchain versioned
> paths in Libs.private like:
>   /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libfdt.so
> which obviously breaks on toolchain updates.
>
> In general libs used multiple times - ipn3ke + ifpga in this case - are
> checked centrally in config/meson.build so move it there and fix the
> adding of dependencies to not use the full file path.

It worked on top of 19.11.4 but the pipeline on top of master complains.
I beg your pardon that I don't have the time left today for a v2, but as an
RFC it should already be enough to get the discussion started on the topic.

> The result is libfdt in pkg-config now showing up as:
>   Libs.private: -pthread -lm -ldl -lnuma -lfdt -lpcap
>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  config/meson.build             | 9 +++++++++
>  drivers/net/ipn3ke/meson.build | 6 +-----
>  drivers/raw/ifpga/meson.build  | 7 +------
>  3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/config/meson.build b/config/meson.build
> index cff8b33dd2..1c8317e750 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -150,6 +150,15 @@ if numa_dep.found() and cc.has_header('numaif.h')
>         dpdk_extra_ldflags += '-lnuma'
>  endif
>
> +has_libfdt = 0
> +fdt_dep = cc.find_library('libfdt', required: false)
> +if fdt_dep.found() and cc.has_header('fdt.h')
> +       dpdk_conf.set10('RTE_HAS_LIBFDT', true)
> +       has_libfdt = 1
> +       add_project_link_arguments('-lfdt', language: 'c')
> +       dpdk_extra_ldflags += '-lfdt'
> +endif
> +
>  # check for libbsd
>  libbsd = dependency('libbsd', required: false)
>  if libbsd.found()
> diff --git a/drivers/net/ipn3ke/meson.build b/drivers/net/ipn3ke/meson.build
> index ec9cb7daf0..de6e03ca65 100644
> --- a/drivers/net/ipn3ke/meson.build
> +++ b/drivers/net/ipn3ke/meson.build
> @@ -9,11 +9,7 @@
>  #  rte_eth_switch_domain_free()
>  #
>
> -dep = dependency('libfdt', required: false)
> -if not dep.found()
> -       dep = cc.find_library('libfdt', required: false)
> -endif
> -if not dep.found()
> +if has_libnuma == 0
>         build = false
>         reason = 'missing dependency, "libfdt"'
>         subdir_done()
> diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.build
> index 05a1711b5d..d4a128d67e 100644
> --- a/drivers/raw/ifpga/meson.build
> +++ b/drivers/raw/ifpga/meson.build
> @@ -1,11 +1,7 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2018 Intel Corporation
>
> -dep = dependency('libfdt', required: false)
> -if not dep.found()
> -       dep = cc.find_library('libfdt', required: false)
> -endif
> -if not dep.found()
> +if has_libnuma == 0
>         build = false
>         reason = 'missing dependency, "libfdt"'
>         subdir_done()
> @@ -16,7 +12,6 @@ objs = [base_objs]
>
>  deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs',
>         'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke']
> -ext_deps += dep
>
>  sources = files('ifpga_rawdev.c')
>
> --
> 2.28.0
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config
  2020-09-01 15:58 [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config Christian Ehrhardt
  2020-09-01 16:10 ` Christian Ehrhardt
@ 2020-09-01 16:16 ` Luca Boccassi
  2020-09-02 11:09   ` Christian Ehrhardt
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Boccassi @ 2020-09-01 16:16 UTC (permalink / raw)
  To: Christian Ehrhardt, dev

On Tue, 2020-09-01 at 17:58 +0200, Christian Ehrhardt wrote:
> The checks for libfdt try dependency() first which would only work if
> a pkg-config would be present but libfdt has none.
> Then it probes for the lib path itself via cc.find_library.
> 
> But later it adds the result of either probe to ext_deps which ends up
> in build and also the resulting pkg-config to contain toolchain versioned
> paths in Libs.private like:
>   /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libfdt.so
> which obviously breaks on toolchain updates.
> 
> In general libs used multiple times - ipn3ke + ifpga in this case - are
> checked centrally in config/meson.build so move it there and fix the
> adding of dependencies to not use the full file path.
> 
> The result is libfdt in pkg-config now showing up as:
>   Libs.private: -pthread -lm -ldl -lnuma -lfdt -lpcap
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  config/meson.build             | 9 +++++++++
>  drivers/net/ipn3ke/meson.build | 6 +-----
>  drivers/raw/ifpga/meson.build  | 7 +------
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/config/meson.build b/config/meson.build
> index cff8b33dd2..1c8317e750 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -150,6 +150,15 @@ if numa_dep.found() and cc.has_header('numaif.h')
>  	dpdk_extra_ldflags += '-lnuma'
>  endif
>  
> +has_libfdt = 0
> +fdt_dep = cc.find_library('libfdt', required: false)
> +if fdt_dep.found() and cc.has_header('fdt.h')
> +	dpdk_conf.set10('RTE_HAS_LIBFDT', true)
> +	has_libfdt = 1
> +	add_project_link_arguments('-lfdt', language: 'c')
> +	dpdk_extra_ldflags += '-lfdt'
> +endif
> +
>  # check for libbsd
>  libbsd = dependency('libbsd', required: false)
>  if libbsd.found()
> diff --git a/drivers/net/ipn3ke/meson.build b/drivers/net/ipn3ke/meson.build
> index ec9cb7daf0..de6e03ca65 100644
> --- a/drivers/net/ipn3ke/meson.build
> +++ b/drivers/net/ipn3ke/meson.build
> @@ -9,11 +9,7 @@
>  #  rte_eth_switch_domain_free()
>  #
>  
> -dep = dependency('libfdt', required: false)
> -if not dep.found()
> -	dep = cc.find_library('libfdt', required: false)
> -endif
> -if not dep.found()
> +if has_libnuma == 0
>  	build = false
>  	reason = 'missing dependency, "libfdt"'
>  	subdir_done()
> diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.build
> index 05a1711b5d..d4a128d67e 100644
> --- a/drivers/raw/ifpga/meson.build
> +++ b/drivers/raw/ifpga/meson.build
> @@ -1,11 +1,7 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2018 Intel Corporation
>  
> -dep = dependency('libfdt', required: false)
> -if not dep.found()
> -	dep = cc.find_library('libfdt', required: false)
> -endif
> -if not dep.found()
> +if has_libnuma == 0

if has_libfdt == 0 ? Same above

>  	build = false
>  	reason = 'missing dependency, "libfdt"'
>  	subdir_done()
> @@ -16,7 +12,6 @@ objs = [base_objs]
>  
>  deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs',
>  	'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke']
> -ext_deps += dep
>  
>  sources = files('ifpga_rawdev.c')

With the above correction, LGTM.

Reviewed-by: Luca Boccassi <bluca@debian.org>

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config
  2020-09-01 16:16 ` Luca Boccassi
@ 2020-09-02 11:09   ` Christian Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2020-09-02 11:09 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Tue, Sep 1, 2020 at 6:16 PM Luca Boccassi <bluca@debian.org> wrote:
>
> On Tue, 2020-09-01 at 17:58 +0200, Christian Ehrhardt wrote:
> > The checks for libfdt try dependency() first which would only work if
> > a pkg-config would be present but libfdt has none.
> > Then it probes for the lib path itself via cc.find_library.
> >
> > But later it adds the result of either probe to ext_deps which ends up
> > in build and also the resulting pkg-config to contain toolchain versioned
> > paths in Libs.private like:
> >   /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libfdt.so
> > which obviously breaks on toolchain updates.
> >
> > In general libs used multiple times - ipn3ke + ifpga in this case - are
> > checked centrally in config/meson.build so move it there and fix the
> > adding of dependencies to not use the full file path.
> >
> > The result is libfdt in pkg-config now showing up as:
> >   Libs.private: -pthread -lm -ldl -lnuma -lfdt -lpcap
> >
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >  config/meson.build             | 9 +++++++++
> >  drivers/net/ipn3ke/meson.build | 6 +-----
> >  drivers/raw/ifpga/meson.build  | 7 +------
> >  3 files changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/config/meson.build b/config/meson.build
> > index cff8b33dd2..1c8317e750 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -150,6 +150,15 @@ if numa_dep.found() and cc.has_header('numaif.h')
> >       dpdk_extra_ldflags += '-lnuma'
> >  endif
> >
> > +has_libfdt = 0
> > +fdt_dep = cc.find_library('libfdt', required: false)
> > +if fdt_dep.found() and cc.has_header('fdt.h')
> > +     dpdk_conf.set10('RTE_HAS_LIBFDT', true)
> > +     has_libfdt = 1
> > +     add_project_link_arguments('-lfdt', language: 'c')
> > +     dpdk_extra_ldflags += '-lfdt'
> > +endif
> > +
> >  # check for libbsd
> >  libbsd = dependency('libbsd', required: false)
> >  if libbsd.found()
> > diff --git a/drivers/net/ipn3ke/meson.build b/drivers/net/ipn3ke/meson.build
> > index ec9cb7daf0..de6e03ca65 100644
> > --- a/drivers/net/ipn3ke/meson.build
> > +++ b/drivers/net/ipn3ke/meson.build
> > @@ -9,11 +9,7 @@
> >  #  rte_eth_switch_domain_free()
> >  #
> >
> > -dep = dependency('libfdt', required: false)
> > -if not dep.found()
> > -     dep = cc.find_library('libfdt', required: false)
> > -endif
> > -if not dep.found()
> > +if has_libnuma == 0
> >       build = false
> >       reason = 'missing dependency, "libfdt"'
> >       subdir_done()
> > diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.build
> > index 05a1711b5d..d4a128d67e 100644
> > --- a/drivers/raw/ifpga/meson.build
> > +++ b/drivers/raw/ifpga/meson.build
> > @@ -1,11 +1,7 @@
> >  # SPDX-License-Identifier: BSD-3-Clause
> >  # Copyright(c) 2018 Intel Corporation
> >
> > -dep = dependency('libfdt', required: false)
> > -if not dep.found()
> > -     dep = cc.find_library('libfdt', required: false)
> > -endif
> > -if not dep.found()
> > +if has_libnuma == 0
>
> if has_libfdt == 0 ? Same above
>
> >       build = false
> >       reason = 'missing dependency, "libfdt"'
> >       subdir_done()
> > @@ -16,7 +12,6 @@ objs = [base_objs]
> >
> >  deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs',
> >       'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke']
> > -ext_deps += dep
> >
> >  sources = files('ifpga_rawdev.c')
>
> With the above correction, LGTM.
>
> Reviewed-by: Luca Boccassi <bluca@debian.org>

Fixed and thanks Luca!
CI pipeline (Debian) is happy now.

I added your Reviewed-by and added Thomas/Bruce on --to since they
last modified these files on various meson cleanups.
Will resend the patch as non-RFC with those changes any minute ...

> --
> Kind regards,
> Luca Boccassi



-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-02 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 15:58 [dpdk-dev] [RFC] avoid libfdt checks adding full paths to pkg-config Christian Ehrhardt
2020-09-01 16:10 ` Christian Ehrhardt
2020-09-01 16:16 ` Luca Boccassi
2020-09-02 11:09   ` Christian Ehrhardt

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git