All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] build: use static deps of libs for pkg-config libs.private
@ 2019-01-03 17:57 Luca Boccassi
  2019-01-03 17:57 ` [PATCH 2/2] build: use dependency() instead of find_library() Luca Boccassi
                   ` (7 more replies)
  0 siblings, 8 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-03 17:57 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi, stable

Dependencies of the RTE libraries were not being added to the
Requires.private field of the pc file since the variable used for
dynamic linking was passed to the related field of pkg.generate.
Use the static one so that dependencies are included.

Fixes: 57ae0ec62620 ("build: add dependency on telemetry to apps with meson")
Cc: stable@dpdk.org

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7cee3c94a..617e88589 100644
--- a/meson.build
+++ b/meson.build
@@ -81,7 +81,7 @@ pkg.generate(name: meson.project_name(),
 	filebase: 'lib' + meson.project_name().to_lower(),
 	version: meson.project_version(),
 	libraries: dpdk_libraries,
-	libraries_private: dpdk_drivers + dpdk_libraries +
+	libraries_private: dpdk_drivers + dpdk_static_libraries +
 			['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
 	description: 'The Data Plane Development Kit (DPDK)',
 	subdirs: [get_option('include_subdir_arch'), '.'],
-- 
2.19.2

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

* [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
@ 2019-01-03 17:57 ` Luca Boccassi
  2019-01-07 14:28   ` Bruce Richardson
  2019-01-11 12:38 ` [PATCH v2 1/3] build: use static deps of libs for pkg-config libs.private Luca Boccassi
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-03 17:57 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi, stable

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluos and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

An internal checker has been added to Meson 0.42 to detect libpcap,
which ships a custom tool rather than a pkg-config file, so bump the
minimum Meson version from 0.41 to 0.42.

For libbsd, which is checked in a top level file and used to be added
to the global linker flags array, add it to the ext_deps array of
all top level meson files (app, test, lib, examples, drivers). The
most correct change would be to let each individual library/driver/app
depend on it individually if they use symbols from it, but it would
diverge from the legacy Makefile's behaviour and make life a bit more
difficult for contributors.

Fixes: a25a650be5f0 ("build: add infrastructure for meson and ninja builds")
Cc: stable@dpdk.org

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

Bruce, dependency() by default tries pkg-config first, then cmake, then
the internal project-specific finders (like pcap). If you think it's
worth it I can add fallbacks in case a system, for whatever reason,
does not install a pc file despite the upstream project providing one.
It would add more clutter and more verbosity, but it would not cause
other issues.

 app/meson.build                    |  2 +-
 config/meson.build                 | 10 +++++-----
 drivers/crypto/ccp/meson.build     |  1 -
 drivers/crypto/openssl/meson.build |  1 -
 drivers/crypto/qat/meson.build     |  1 -
 drivers/meson.build                |  4 ++--
 drivers/net/bnx2x/meson.build      |  2 +-
 drivers/net/mlx4/meson.build       |  6 +++---
 drivers/net/mlx5/meson.build       |  6 +++---
 drivers/net/pcap/meson.build       |  5 ++---
 examples/meson.build               |  2 +-
 lib/librte_bpf/meson.build         |  4 ++--
 lib/librte_telemetry/meson.build   |  2 +-
 lib/meson.build                    |  2 +-
 meson.build                        |  2 +-
 test/test/meson.build              |  1 +
 16 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/app/meson.build b/app/meson.build
index 47a2a8615..e31386f1a 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -29,7 +29,7 @@ foreach app:apps
 
 	# use "deps" for internal DPDK dependencies, and "ext_deps" for
 	# external package/library requirements
-	ext_deps = []
+	ext_deps = [libbsd]
 	deps = dpdk_app_link_libraries
 
 	subdir(name)
diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index c2a0dd8ba..80e5e8835 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -8,4 +8,3 @@ endif
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..f442f9719 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,11 +46,11 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
+		# using dependency(). For most cases, we
 		# probably also need to specify the "-l" flags in
 		# pkgconfig_extra_libs variable too, so that it can be reflected
 		# in the pkgconfig output for static builds
-		ext_deps = []
+		ext_deps = [libbsd]
 		pkgconfig_extra_libs = []
 
 		# pull in driver directory which should assign to each of the above
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 7de571e2a..4ba4e93b6 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 28938db0f..7ff3660fa 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..89c9d7a74 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
 	build = false
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
diff --git a/examples/meson.build b/examples/meson.build
index af81c762e..881e2da33 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -33,7 +33,7 @@ foreach example: examples
 	allow_experimental_apis = false
 	cflags = default_cflags
 
-	ext_deps = [execinfo]
+	ext_deps = [execinfo libbsd]
 	includes = [include_directories(example)]
 	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
 	subdir(example)
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
diff --git a/lib/meson.build b/lib/meson.build
index a2dd52e17..b2a18f488 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -51,7 +51,7 @@ foreach l:libraries
 
 	# use "deps" for internal DPDK dependencies, and "ext_deps" for
 	# external package/library requirements
-	ext_deps = []
+	ext_deps = [libbsd]
 	deps = []
 	# eal is standard dependency once built
 	if dpdk_conf.has('RTE_LIBRTE_EAL')
diff --git a/meson.build b/meson.build
index 617e88589..f87dc235f 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.02.0-rc1',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.42'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
diff --git a/test/test/meson.build b/test/test/meson.build
index 5a4816fed..886c29fb4 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -279,6 +279,7 @@ foreach d:test_deps
 	test_dep_objs += get_variable(def_lib + '_rte_' + d)
 endforeach
 test_dep_objs += cc.find_library('execinfo', required: false)
+test_dep_objs += libbsd
 
 link_libs = []
 if get_option('default_library') == 'static'
-- 
2.19.2

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

* Re: [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-03 17:57 ` [PATCH 2/2] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-07 14:28   ` Bruce Richardson
  2019-01-07 16:39     ` [dpdk-stable] " Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-07 14:28 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, stable

On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi wrote:
> Whenever possible (if the library ships a pkg-config file) use meson's
> dependency() function to look for it, as it will automatically add it
> to the Requires.private list if needed, to allow for static builds to
> succeed for reverse dependencies of DPDK. Otherwise the recursive
> dependencies are not parsed, and users doing static builds have to
> resolve them manually by themselves.
> When using this API avoid additional checks that are superfluos and
> take extra time, and avoid adding the linker flag manually which causes
> it to be duplicated.
> 
> An internal checker has been added to Meson 0.42 to detect libpcap,
> which ships a custom tool rather than a pkg-config file, so bump the
> minimum Meson version from 0.41 to 0.42.

If we are going to bump the version, I think we should bump it further to
e.g. 0.46 or 0.47 unless there is anyone who still wants an earlier
version. That should get rid of a number of the meson version warnings we
see on each run.

> 
> For libbsd, which is checked in a top level file and used to be added
> to the global linker flags array, add it to the ext_deps array of
> all top level meson files (app, test, lib, examples, drivers). The
> most correct change would be to let each individual library/driver/app
> depend on it individually if they use symbols from it, but it would
> diverge from the legacy Makefile's behaviour and make life a bit more
> difficult for contributors.

It shouldn't be necessary to add libbsd as a dependency for everything. I
think just adding it as a dependency of EAL should work fine. However, in
conjunction with meson version checks, I believe this was done this way
originally because of a meson bug which caused recursive dependencies for
things like this to get duplicated many times in the build.ninja file.

https://github.com/mesonbuild/meson/issues/2150

If we take the approach of adding bsd explicitly using dependency object
our minimum version needs to have the fix for this bug included.

> 
> Fixes: a25a650be5f0 ("build: add infrastructure for meson and ninja builds")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> 
> Bruce, dependency() by default tries pkg-config first, then cmake, then
> the internal project-specific finders (like pcap). If you think it's
> worth it I can add fallbacks in case a system, for whatever reason,
> does not install a pc file despite the upstream project providing one.
> It would add more clutter and more verbosity, but it would not cause
> other issues.

I'd prefer to keep it without that for now. If the lack of .pc files causes
issues we can revisit.

/Bruce

> 

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 14:28   ` Bruce Richardson
@ 2019-01-07 16:39     ` Luca Boccassi
  2019-01-07 16:55       ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-07 16:39 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi wrote:
> > Whenever possible (if the library ships a pkg-config file) use
> > meson's
> > dependency() function to look for it, as it will automatically add
> > it
> > to the Requires.private list if needed, to allow for static builds
> > to
> > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > dependencies are not parsed, and users doing static builds have to
> > resolve them manually by themselves.
> > When using this API avoid additional checks that are superfluos and
> > take extra time, and avoid adding the linker flag manually which
> > causes
> > it to be duplicated.
> > 
> > An internal checker has been added to Meson 0.42 to detect libpcap,
> > which ships a custom tool rather than a pkg-config file, so bump
> > the
> > minimum Meson version from 0.41 to 0.42.
> 
> If we are going to bump the version, I think we should bump it
> further to
> e.g. 0.46 or 0.47 unless there is anyone who still wants an earlier
> version. That should get rid of a number of the meson version
> warnings we
> see on each run.

The distros situation, as far as I can see:

Debian 10 0.49
Ubuntu 18.04 LTS 0.45
Ubuntu 18.10 0.47
Fedora 27 0.43
Fedora 28 0.45
SUSE Leap 15 0.46
FreeBSD 10 0.46
CentOS 7 0.47

So by bumping to 0.47, required to fix the bug below, we'd leave behind
a fair few distros.

Now for me it's fine to go to 0.47 - but I think the CC to stable
should then be removed.

> > 
> > For libbsd, which is checked in a top level file and used to be
> > added
> > to the global linker flags array, add it to the ext_deps array of
> > all top level meson files (app, test, lib, examples, drivers). The
> > most correct change would be to let each individual
> > library/driver/app
> > depend on it individually if they use symbols from it, but it would
> > diverge from the legacy Makefile's behaviour and make life a bit
> > more
> > difficult for contributors.
> 
> It shouldn't be necessary to add libbsd as a dependency for
> everything. I
> think just adding it as a dependency of EAL should work fine. 

Won't that mean that the shared libraries other than EAL will have
undefined references?
Now, in practice it would be fine because I'm pretty sure none of them
can and would actually be used without EAL, so when linking executables
everything will be fine, but for example the Debian build tools will at
the very least print warnings if a shared library links

> However, in
> conjunction with meson version checks, I believe this was done this
> way
> originally because of a meson bug which caused recursive dependencies
> for
> things like this to get duplicated many times in the build.ninja
> file.
> 
> https://github.com/mesonbuild/meson/issues/2150
> 
> If we take the approach of adding bsd explicitly using dependency
> object
> our minimum version needs to have the fix for this bug included.

Ah that's not nice. Just verified, and it happens with dependency() as
well as find_library(). It was fixed in 0.47.1.

> > 
> > Fixes: a25a650be5f0 ("build: add infrastructure for meson and ninja
> > builds")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > 
> > Bruce, dependency() by default tries pkg-config first, then cmake,
> > then
> > the internal project-specific finders (like pcap). If you think
> > it's
> > worth it I can add fallbacks in case a system, for whatever reason,
> > does not install a pc file despite the upstream project providing
> > one.
> > It would add more clutter and more verbosity, but it would not
> > cause
> > other issues.
> 
> I'd prefer to keep it without that for now. If the lack of .pc files
> causes
> issues we can revisit.
> 
> /Bruce

Ok.

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 16:39     ` [dpdk-stable] " Luca Boccassi
@ 2019-01-07 16:55       ` Bruce Richardson
  2019-01-07 17:03         ` [dpdk-techboard] " Thomas Monjalon
  2019-01-11 11:10         ` [dpdk-stable] " Luca Boccassi
  0 siblings, 2 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-07 16:55 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, stable, techboard

On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi wrote:
> > > Whenever possible (if the library ships a pkg-config file) use
> > > meson's
> > > dependency() function to look for it, as it will automatically add
> > > it
> > > to the Requires.private list if needed, to allow for static builds
> > > to
> > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > dependencies are not parsed, and users doing static builds have to
> > > resolve them manually by themselves.
> > > When using this API avoid additional checks that are superfluos and
> > > take extra time, and avoid adding the linker flag manually which
> > > causes
> > > it to be duplicated.
> > > 
> > > An internal checker has been added to Meson 0.42 to detect libpcap,
> > > which ships a custom tool rather than a pkg-config file, so bump
> > > the
> > > minimum Meson version from 0.41 to 0.42.
> > 
> > If we are going to bump the version, I think we should bump it
> > further to
> > e.g. 0.46 or 0.47 unless there is anyone who still wants an earlier
> > version. That should get rid of a number of the meson version
> > warnings we
> > see on each run.
> 
> The distros situation, as far as I can see:
> 
> Debian 10 0.49
> Ubuntu 18.04 LTS 0.45
> Ubuntu 18.10 0.47
> Fedora 27 0.43
> Fedora 28 0.45
> SUSE Leap 15 0.46
> FreeBSD 10 0.46
> CentOS 7 0.47
> 
> So by bumping to 0.47, required to fix the bug below, we'd leave behind
> a fair few distros.
> 
> Now for me it's fine to go to 0.47 - but I think the CC to stable
> should then be removed.
> 

Looking at the list probably 0.45 is safe for now. The follow-up question
is whether expecting people to get updated meson using pip is reasonable.
If it is, then I'm all in favour of bumping min to 0.47.1 and taking in
your changes below.

> > > 
> > > For libbsd, which is checked in a top level file and used to be
> > > added
> > > to the global linker flags array, add it to the ext_deps array of
> > > all top level meson files (app, test, lib, examples, drivers). The
> > > most correct change would be to let each individual
> > > library/driver/app
> > > depend on it individually if they use symbols from it, but it would
> > > diverge from the legacy Makefile's behaviour and make life a bit
> > > more
> > > difficult for contributors.
> > 
> > It shouldn't be necessary to add libbsd as a dependency for
> > everything. I
> > think just adding it as a dependency of EAL should work fine. 
> 
> Won't that mean that the shared libraries other than EAL will have
> undefined references?

Should not happen. AFAIK when you link against a library in meson it will
also link against any of that libraries dependencies too. For shared
libraries meson always disallowed undefined references in the linker
commandline. [To have libs with undefined refs, e.g. plugins, you need to
use "shared_module" rather than "shared_library" command].

> Now, in practice it would be fine because I'm pretty sure none of them
> can and would actually be used without EAL, so when linking executables
> everything will be fine, but for example the Debian build tools will at
> the very least print warnings if a shared library links
> 
> > However, in
> > conjunction with meson version checks, I believe this was done this
> > way
> > originally because of a meson bug which caused recursive dependencies
> > for
> > things like this to get duplicated many times in the build.ninja
> > file.
> > 
> > https://github.com/mesonbuild/meson/issues/2150
> > 
> > If we take the approach of adding bsd explicitly using dependency
> > object
> > our minimum version needs to have the fix for this bug included.
> 
> Ah that's not nice. Just verified, and it happens with dependency() as
> well as find_library(). It was fixed in 0.47.1.
> 

Yep, it was a right royal pain when I was doing the original work. Now that
there is a fix in, we can do cleanups like you suggest if we are prepared
to bump our minimum version.

I'll refer back to the key question here:
"Is it reasonable to ask users compiling DPDK to pull meson from pip rather
than using the distro built-in version?"
[Adding techboard on CC, in the hopes they might have some thoughts]

If it is ok for most folks, and personally I don't think it's a big deal,
then that gives us a faster path forward. If not, we raise the minimum more
slowly, and keep the existing way of managing the dependencies for a while
longer. Worst case, I'd still hope by 19.11 LTS for us to have minimum
0.47.1 to have the fix in question.

/Bruce

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

* Re: [dpdk-techboard] [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 16:55       ` Bruce Richardson
@ 2019-01-07 17:03         ` Thomas Monjalon
  2019-01-07 17:45           ` [dpdk-stable] [dpdk-techboard] " Thomas Monjalon
  2019-01-11 11:10         ` [dpdk-stable] " Luca Boccassi
  1 sibling, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-01-07 17:03 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: techboard, Luca Boccassi, dev, stable

07/01/2019 17:55, Bruce Richardson:
> On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > However, in
> > > conjunction with meson version checks, I believe this was done this
> > > way
> > > originally because of a meson bug which caused recursive dependencies
> > > for
> > > things like this to get duplicated many times in the build.ninja
> > > file.
> > > 
> > > https://github.com/mesonbuild/meson/issues/2150
> > > 
> > > If we take the approach of adding bsd explicitly using dependency
> > > object
> > > our minimum version needs to have the fix for this bug included.
> > 
> > Ah that's not nice. Just verified, and it happens with dependency() as
> > well as find_library(). It was fixed in 0.47.1.
> > 
> 
> Yep, it was a right royal pain when I was doing the original work. Now that
> there is a fix in, we can do cleanups like you suggest if we are prepared
> to bump our minimum version.
> 
> I'll refer back to the key question here:
> "Is it reasonable to ask users compiling DPDK to pull meson from pip rather
> than using the distro built-in version?"
> [Adding techboard on CC, in the hopes they might have some thoughts]
> 
> If it is ok for most folks, and personally I don't think it's a big deal,
> then that gives us a faster path forward. If not, we raise the minimum more
> slowly, and keep the existing way of managing the dependencies for a while
> longer. Worst case, I'd still hope by 19.11 LTS for us to have minimum
> 0.47.1 to have the fix in question.

Please, could you describe what are the meson versions in major distros?

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

* Re: [dpdk-stable] [dpdk-techboard] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 17:03         ` [dpdk-techboard] " Thomas Monjalon
@ 2019-01-07 17:45           ` Thomas Monjalon
  2019-01-07 21:09             ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-01-07 17:45 UTC (permalink / raw)
  To: Bruce Richardson, Luca Boccassi; +Cc: stable, techboard, dev

07/01/2019 18:03, Thomas Monjalon:
> 07/01/2019 17:55, Bruce Richardson:
> > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > However, in
> > > > conjunction with meson version checks, I believe this was done this
> > > > way
> > > > originally because of a meson bug which caused recursive dependencies
> > > > for
> > > > things like this to get duplicated many times in the build.ninja
> > > > file.
> > > > 
> > > > https://github.com/mesonbuild/meson/issues/2150
> > > > 
> > > > If we take the approach of adding bsd explicitly using dependency
> > > > object
> > > > our minimum version needs to have the fix for this bug included.
> > > 
> > > Ah that's not nice. Just verified, and it happens with dependency() as
> > > well as find_library(). It was fixed in 0.47.1.
> > > 
> > 
> > Yep, it was a right royal pain when I was doing the original work. Now that
> > there is a fix in, we can do cleanups like you suggest if we are prepared
> > to bump our minimum version.
> > 
> > I'll refer back to the key question here:
> > "Is it reasonable to ask users compiling DPDK to pull meson from pip rather
> > than using the distro built-in version?"
> > [Adding techboard on CC, in the hopes they might have some thoughts]
> > 
> > If it is ok for most folks, and personally I don't think it's a big deal,
> > then that gives us a faster path forward. If not, we raise the minimum more
> > slowly, and keep the existing way of managing the dependencies for a while
> > longer. Worst case, I'd still hope by 19.11 LTS for us to have minimum
> > 0.47.1 to have the fix in question.
> 
> Please, could you describe what are the meson versions in major distros?

It was already listed by Luca in this thread (thanks Bruce).
I looks like latest Debian/Ubuntu and Fedora have meson 0.47 or higher.

I vote for bumping to meson 0.47.

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

* Re: [dpdk-stable] [dpdk-techboard] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 17:45           ` [dpdk-stable] [dpdk-techboard] " Thomas Monjalon
@ 2019-01-07 21:09             ` Luca Boccassi
  2019-01-07 22:03               ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-07 21:09 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson; +Cc: techboard, dev

On Mon, 2019-01-07 at 18:45 +0100, Thomas Monjalon wrote:
> 07/01/2019 18:03, Thomas Monjalon:
> > 07/01/2019 17:55, Bruce Richardson:
> > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > > However, in
> > > > > conjunction with meson version checks, I believe this was
> > > > > done this
> > > > > way
> > > > > originally because of a meson bug which caused recursive
> > > > > dependencies
> > > > > for
> > > > > things like this to get duplicated many times in the
> > > > > build.ninja
> > > > > file.
> > > > > 
> > > > > https://github.com/mesonbuild/meson/issues/2150
> > > > > 
> > > > > If we take the approach of adding bsd explicitly using
> > > > > dependency
> > > > > object
> > > > > our minimum version needs to have the fix for this bug
> > > > > included.
> > > > 
> > > > Ah that's not nice. Just verified, and it happens with
> > > > dependency() as
> > > > well as find_library(). It was fixed in 0.47.1.
> > > > 
> > > 
> > > Yep, it was a right royal pain when I was doing the original
> > > work. Now that
> > > there is a fix in, we can do cleanups like you suggest if we are
> > > prepared
> > > to bump our minimum version.
> > > 
> > > I'll refer back to the key question here:
> > > "Is it reasonable to ask users compiling DPDK to pull meson from
> > > pip rather
> > > than using the distro built-in version?"
> > > [Adding techboard on CC, in the hopes they might have some
> > > thoughts]
> > > 
> > > If it is ok for most folks, and personally I don't think it's a
> > > big deal,
> > > then that gives us a faster path forward. If not, we raise the
> > > minimum more
> > > slowly, and keep the existing way of managing the dependencies
> > > for a while
> > > longer. Worst case, I'd still hope by 19.11 LTS for us to have
> > > minimum
> > > 0.47.1 to have the fix in question.
> > 
> > Please, could you describe what are the meson versions in major
> > distros?
> 
> It was already listed by Luca in this thread (thanks Bruce).
> I looks like latest Debian/Ubuntu and Fedora have meson 0.47 or
> higher.
> 
> I vote for bumping to meson 0.47.

For the benefit of the rest of the tech board which was not CCed
directly in the original thread:

Debian 10 0.49
Ubuntu 18.04 LTS 0.45
Ubuntu 18.10 0.47
Fedora 27 0.43
Fedora 28 0.45
SUSE Leap 15 0.46
FreeBSD 10 0.46
CentOS 7 0.47

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [dpdk-techboard] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 21:09             ` Luca Boccassi
@ 2019-01-07 22:03               ` Luca Boccassi
  0 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-07 22:03 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson; +Cc: techboard, dev

On Mon, 2019-01-07 at 21:09 +0000, Luca Boccassi wrote:
> On Mon, 2019-01-07 at 18:45 +0100, Thomas Monjalon wrote:
> > 07/01/2019 18:03, Thomas Monjalon:
> > > 07/01/2019 17:55, Bruce Richardson:
> > > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > > > However, in
> > > > > > conjunction with meson version checks, I believe this was
> > > > > > done this
> > > > > > way
> > > > > > originally because of a meson bug which caused recursive
> > > > > > dependencies
> > > > > > for
> > > > > > things like this to get duplicated many times in the
> > > > > > build.ninja
> > > > > > file.
> > > > > > 
> > > > > > https://github.com/mesonbuild/meson/issues/2150
> > > > > > 
> > > > > > If we take the approach of adding bsd explicitly using
> > > > > > dependency
> > > > > > object
> > > > > > our minimum version needs to have the fix for this bug
> > > > > > included.
> > > > > 
> > > > > Ah that's not nice. Just verified, and it happens with
> > > > > dependency() as
> > > > > well as find_library(). It was fixed in 0.47.1.
> > > > > 
> > > > 
> > > > Yep, it was a right royal pain when I was doing the original
> > > > work. Now that
> > > > there is a fix in, we can do cleanups like you suggest if we
> > > > are
> > > > prepared
> > > > to bump our minimum version.
> > > > 
> > > > I'll refer back to the key question here:
> > > > "Is it reasonable to ask users compiling DPDK to pull meson
> > > > from
> > > > pip rather
> > > > than using the distro built-in version?"
> > > > [Adding techboard on CC, in the hopes they might have some
> > > > thoughts]
> > > > 
> > > > If it is ok for most folks, and personally I don't think it's a
> > > > big deal,
> > > > then that gives us a faster path forward. If not, we raise the
> > > > minimum more
> > > > slowly, and keep the existing way of managing the dependencies
> > > > for a while
> > > > longer. Worst case, I'd still hope by 19.11 LTS for us to have
> > > > minimum
> > > > 0.47.1 to have the fix in question.
> > > 
> > > Please, could you describe what are the meson versions in major
> > > distros?
> > 
> > It was already listed by Luca in this thread (thanks Bruce).
> > I looks like latest Debian/Ubuntu and Fedora have meson 0.47 or
> > higher.
> > 
> > I vote for bumping to meson 0.47.
> 
> For the benefit of the rest of the tech board which was not CCed
> directly in the original thread:
> 
> Debian 10 0.49
> Ubuntu 18.04 LTS 0.45
> Ubuntu 18.10 0.47
> Fedora 27 0.43
> Fedora 28 0.45
> SUSE Leap 15 0.46
> FreeBSD 10 0.46
> CentOS 7 0.47

Errata: meson is not in CentOS proper at all, it's only in the extra
repositories.

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-07 16:55       ` Bruce Richardson
  2019-01-07 17:03         ` [dpdk-techboard] " Thomas Monjalon
@ 2019-01-11 11:10         ` Luca Boccassi
  2019-01-11 11:52           ` Bruce Richardson
  1 sibling, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 11:10 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi wrote:
> > > > For libbsd, which is checked in a top level file and used to be
> > > > added
> > > > to the global linker flags array, add it to the ext_deps array
> > > > of
> > > > all top level meson files (app, test, lib, examples, drivers).
> > > > The
> > > > most correct change would be to let each individual
> > > > library/driver/app
> > > > depend on it individually if they use symbols from it, but it
> > > > would
> > > > diverge from the legacy Makefile's behaviour and make life a
> > > > bit
> > > > more
> > > > difficult for contributors.
> > > 
> > > It shouldn't be necessary to add libbsd as a dependency for
> > > everything. I
> > > think just adding it as a dependency of EAL should work fine. 
> > 
> > Won't that mean that the shared libraries other than EAL will have
> > undefined references?
> 
> Should not happen. AFAIK when you link against a library in meson it
> will
> also link against any of that libraries dependencies too. For shared
> libraries meson always disallowed undefined references in the linker
> commandline. [To have libs with undefined refs, e.g. plugins, you
> need to
> use "shared_module" rather than "shared_library" command].

Looked at this again, and rte_cmdline is using strlcpy as well, and
it's built before rte_eal, so it fails:

lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c.o: In function `cmdline_complete':
cmdline_parse.c:(.text+0x861): undefined reference to `strlcpy'

Adding it to ext_deps in both rte_cmdline and rte_eal works. Is that an acceptable compromise?

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-11 11:10         ` [dpdk-stable] " Luca Boccassi
@ 2019-01-11 11:52           ` Bruce Richardson
  2019-01-11 12:39             ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 11:52 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, stable

On Fri, Jan 11, 2019 at 11:10:28AM +0000, Luca Boccassi wrote:
> On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi wrote:
> > > > > For libbsd, which is checked in a top level file and used to be
> > > > > added
> > > > > to the global linker flags array, add it to the ext_deps array
> > > > > of
> > > > > all top level meson files (app, test, lib, examples, drivers).
> > > > > The
> > > > > most correct change would be to let each individual
> > > > > library/driver/app
> > > > > depend on it individually if they use symbols from it, but it
> > > > > would
> > > > > diverge from the legacy Makefile's behaviour and make life a
> > > > > bit
> > > > > more
> > > > > difficult for contributors.
> > > > 
> > > > It shouldn't be necessary to add libbsd as a dependency for
> > > > everything. I
> > > > think just adding it as a dependency of EAL should work fine. 
> > > 
> > > Won't that mean that the shared libraries other than EAL will have
> > > undefined references?
> > 
> > Should not happen. AFAIK when you link against a library in meson it
> > will
> > also link against any of that libraries dependencies too. For shared
> > libraries meson always disallowed undefined references in the linker
> > commandline. [To have libs with undefined refs, e.g. plugins, you
> > need to
> > use "shared_module" rather than "shared_library" command].
> 
> Looked at this again, and rte_cmdline is using strlcpy as well, and
> it's built before rte_eal, so it fails:
> 
> lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c.o: In function `cmdline_complete':
> cmdline_parse.c:(.text+0x861): undefined reference to `strlcpy'
> 
> Adding it to ext_deps in both rte_cmdline and rte_eal works. Is that an acceptable compromise?
> 
Sure. If eal has a dependency on cmdline, you probably don't need to add it
as an external dependency to EAL too, but it doesn't really hurt to do so.

/Bruce

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

* [PATCH v2 1/3] build: use static deps of libs for pkg-config libs.private
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
  2019-01-03 17:57 ` [PATCH 2/2] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-11 12:38 ` Luca Boccassi
  2019-01-11 12:38   ` [PATCH v2 2/3] build: use dependency() instead of find_library() Luca Boccassi
  2019-01-11 12:38   ` [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd Luca Boccassi
  2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 12:38 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi, stable

Dependencies of the RTE libraries were not being added to the
Requires.private field of the pc file since the variable used for
dynamic linking was passed to the related field of pkg.generate.
Use the static one so that dependencies are included.

Fixes: 57ae0ec62620 ("build: add dependency on telemetry to apps with meson")
Cc: stable@dpdk.org

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 426e0bf3a..d500507c5 100644
--- a/meson.build
+++ b/meson.build
@@ -81,7 +81,7 @@ pkg.generate(name: meson.project_name(),
 	filebase: 'lib' + meson.project_name().to_lower(),
 	version: meson.project_version(),
 	libraries: dpdk_libraries,
-	libraries_private: dpdk_drivers + dpdk_libraries +
+	libraries_private: dpdk_drivers + dpdk_static_libraries +
 			['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
 	description: '''The Data Plane Development Kit (DPDK).
 Note that CFLAGS might contain an -march flag higher than typical baseline.
-- 
2.20.1

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

* [PATCH v2 2/3] build: use dependency() instead of find_library()
  2019-01-11 12:38 ` [PATCH v2 1/3] build: use static deps of libs for pkg-config libs.private Luca Boccassi
@ 2019-01-11 12:38   ` Luca Boccassi
  2019-01-11 12:38   ` [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd Luca Boccassi
  1 sibling, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 12:38 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluos and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

An internal checker has been added to Meson 0.42 to detect libpcap,
which ships a custom tool rather than a pkg-config file, so bump the
minimum Meson version from 0.41 to 0.42.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required

 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 2 +-
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 drivers/net/pcap/meson.build       | 5 ++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 meson.build                        | 2 +-
 11 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index c2a0dd8ba..80e5e8835 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -8,4 +8,3 @@ endif
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..91bc6dc3f 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,7 +46,7 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
+		# using dependency() (preferred) or find_library(). For most cases, we
 		# probably also need to specify the "-l" flags in
 		# pkgconfig_extra_libs variable too, so that it can be reflected
 		# in the pkgconfig output for static builds
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 7de571e2a..4ba4e93b6 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 8ba19e818..161c5641f 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..89c9d7a74 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
 	build = false
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
diff --git a/meson.build b/meson.build
index d500507c5..35126106a 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.02.0-rc1',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.42'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
-- 
2.20.1

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

* [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd
  2019-01-11 12:38 ` [PATCH v2 1/3] build: use static deps of libs for pkg-config libs.private Luca Boccassi
  2019-01-11 12:38   ` [PATCH v2 2/3] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-11 12:38   ` Luca Boccassi
  2019-01-11 14:27     ` Bruce Richardson
  1 sibling, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 12:38 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it, and librte_cmdline which is built before
librte_eal.
Bump Meson dependency to 0.47.1, to avoid bug where the linker flag of
the dependency gets replicated again and again.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
    libbsd dependency to eal and cmdline

 config/meson.build             | 10 +++++-----
 lib/librte_cmdline/meson.build |  4 ++++
 lib/librte_eal/meson.build     |  3 +++
 meson.build                    |  2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_cmdline/meson.build b/lib/librte_cmdline/meson.build
index 30498906c..be286d4a2 100644
--- a/lib/librte_cmdline/meson.build
+++ b/lib/librte_cmdline/meson.build
@@ -5,6 +5,10 @@
 includes = [global_inc]
 includes += include_directories('../librte_eal/common/include')
 
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
+
 version = 2
 sources = files('cmdline.c',
 	'cmdline_cirbuf.c',
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@ version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
diff --git a/meson.build b/meson.build
index 35126106a..4041eccb6 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.02.0-rc1',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.42'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
-- 
2.20.1

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-11 11:52           ` Bruce Richardson
@ 2019-01-11 12:39             ` Luca Boccassi
  2019-01-11 14:24               ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 12:39 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

On Fri, 2019-01-11 at 11:52 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 11:10:28AM +0000, Luca Boccassi wrote:
> > On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi
> > > > > wrote:
> > > > > > For libbsd, which is checked in a top level file and used
> > > > > > to be
> > > > > > added
> > > > > > to the global linker flags array, add it to the ext_deps
> > > > > > array
> > > > > > of
> > > > > > all top level meson files (app, test, lib, examples,
> > > > > > drivers).
> > > > > > The
> > > > > > most correct change would be to let each individual
> > > > > > library/driver/app
> > > > > > depend on it individually if they use symbols from it, but
> > > > > > it
> > > > > > would
> > > > > > diverge from the legacy Makefile's behaviour and make life
> > > > > > a
> > > > > > bit
> > > > > > more
> > > > > > difficult for contributors.
> > > > > 
> > > > > It shouldn't be necessary to add libbsd as a dependency for
> > > > > everything. I
> > > > > think just adding it as a dependency of EAL should work
> > > > > fine. 
> > > > 
> > > > Won't that mean that the shared libraries other than EAL will
> > > > have
> > > > undefined references?
> > > 
> > > Should not happen. AFAIK when you link against a library in meson
> > > it
> > > will
> > > also link against any of that libraries dependencies too. For
> > > shared
> > > libraries meson always disallowed undefined references in the
> > > linker
> > > commandline. [To have libs with undefined refs, e.g. plugins, you
> > > need to
> > > use "shared_module" rather than "shared_library" command].
> > 
> > Looked at this again, and rte_cmdline is using strlcpy as well, and
> > it's built before rte_eal, so it fails:
> > 
> > lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c.o: In
> > function `cmdline_complete':
> > cmdline_parse.c:(.text+0x861): undefined reference to `strlcpy'
> > 
> > Adding it to ext_deps in both rte_cmdline and rte_eal works. Is
> > that an acceptable compromise?
> > 
> 
> Sure. If eal has a dependency on cmdline, you probably don't need to
> add it
> as an external dependency to EAL too, but it doesn't really hurt to
> do so.
> 
> /Bruce

eal does not depend on cmdline, so added in both in v2. I also split
the libbsd change and meson bump to 0.47.1 in a separate commit in the
series.

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-11 12:39             ` Luca Boccassi
@ 2019-01-11 14:24               ` Bruce Richardson
  2019-01-11 14:56                 ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 14:24 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, stable

On Fri, Jan 11, 2019 at 12:39:23PM +0000, Luca Boccassi wrote:
> On Fri, 2019-01-11 at 11:52 +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 11:10:28AM +0000, Luca Boccassi wrote:
> > > On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> > > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi wrote:
> > > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi
> > > > > > wrote:
> > > > > > > For libbsd, which is checked in a top level file and used
> > > > > > > to be
> > > > > > > added
> > > > > > > to the global linker flags array, add it to the ext_deps
> > > > > > > array
> > > > > > > of
> > > > > > > all top level meson files (app, test, lib, examples,
> > > > > > > drivers).
> > > > > > > The
> > > > > > > most correct change would be to let each individual
> > > > > > > library/driver/app
> > > > > > > depend on it individually if they use symbols from it, but
> > > > > > > it
> > > > > > > would
> > > > > > > diverge from the legacy Makefile's behaviour and make life
> > > > > > > a
> > > > > > > bit
> > > > > > > more
> > > > > > > difficult for contributors.
> > > > > > 
> > > > > > It shouldn't be necessary to add libbsd as a dependency for
> > > > > > everything. I
> > > > > > think just adding it as a dependency of EAL should work
> > > > > > fine. 
> > > > > 
> > > > > Won't that mean that the shared libraries other than EAL will
> > > > > have
> > > > > undefined references?
> > > > 
> > > > Should not happen. AFAIK when you link against a library in meson
> > > > it
> > > > will
> > > > also link against any of that libraries dependencies too. For
> > > > shared
> > > > libraries meson always disallowed undefined references in the
> > > > linker
> > > > commandline. [To have libs with undefined refs, e.g. plugins, you
> > > > need to
> > > > use "shared_module" rather than "shared_library" command].
> > > 
> > > Looked at this again, and rte_cmdline is using strlcpy as well, and
> > > it's built before rte_eal, so it fails:
> > > 
> > > lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c.o: In
> > > function `cmdline_complete':
> > > cmdline_parse.c:(.text+0x861): undefined reference to `strlcpy'
> > > 
> > > Adding it to ext_deps in both rte_cmdline and rte_eal works. Is
> > > that an acceptable compromise?
> > > 
> > 
> > Sure. If eal has a dependency on cmdline, you probably don't need to
> > add it
> > as an external dependency to EAL too, but it doesn't really hurt to
> > do so.
> > 
> > /Bruce
> 
> eal does not depend on cmdline, so added in both in v2. I also split
> the libbsd change and meson bump to 0.47.1 in a separate commit in the
> series.
> 
> -- 
If there is no dependency, why is it being built first?

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

* Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd
  2019-01-11 12:38   ` [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd Luca Boccassi
@ 2019-01-11 14:27     ` Bruce Richardson
  2019-01-11 14:30       ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 14:27 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> Move libbsd inclusion to librte_eal, so that all other libraries and
> PMDs will inherit it, and librte_cmdline which is built before
> librte_eal.
> Bump Meson dependency to 0.47.1, to avoid bug where the linker flag of
> the dependency gets replicated again and again.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
>     libbsd dependency to eal and cmdline
> 
>  config/meson.build             | 10 +++++-----
>  lib/librte_cmdline/meson.build |  4 ++++
>  lib/librte_eal/meson.build     |  3 +++
>  meson.build                    |  2 +-
>  4 files changed, 13 insertions(+), 6 deletions(-)
> 
There are some meson version checks in the code that can be removed as
part of this change:

$ git grep meson.version
drivers/meson.build:    if meson.version().version_compare('>=0.47')
kernel/linux/meson.build:       if meson.version().version_compare('>=0.44')
kernel/linux/meson.build:               if meson.version().version_compare('>=0.44')
meson.build:    meson_version: '>= 0.41'
meson.build:if meson.version().version_compare('>=0.47')

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

* Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd
  2019-01-11 14:27     ` Bruce Richardson
@ 2019-01-11 14:30       ` Bruce Richardson
  2019-01-11 15:04         ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 14:30 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > Move libbsd inclusion to librte_eal, so that all other libraries and
> > PMDs will inherit it, and librte_cmdline which is built before
> > librte_eal.
> > Bump Meson dependency to 0.47.1, to avoid bug where the linker flag of
> > the dependency gets replicated again and again.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
> >     libbsd dependency to eal and cmdline
> > 
> >  config/meson.build             | 10 +++++-----
> >  lib/librte_cmdline/meson.build |  4 ++++
> >  lib/librte_eal/meson.build     |  3 +++
> >  meson.build                    |  2 +-
> >  4 files changed, 13 insertions(+), 6 deletions(-)
> > 
> There are some meson version checks in the code that can be removed as
> part of this change:
> 
> $ git grep meson.version
> drivers/meson.build:    if meson.version().version_compare('>=0.47')
> kernel/linux/meson.build:       if meson.version().version_compare('>=0.44')
> kernel/linux/meson.build:               if meson.version().version_compare('>=0.44')
> meson.build:    meson_version: '>= 0.41'
> meson.build:if meson.version().version_compare('>=0.47')
> 
Thinking on this more, I think the version bump to 0.47 should be done in a
separate standalone patch at the start of this set. Then the other patches
can be based on that.

/Bruce

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-11 14:24               ` Bruce Richardson
@ 2019-01-11 14:56                 ` Luca Boccassi
  2019-01-11 15:49                   ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 14:56 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

On Fri, 2019-01-11 at 14:24 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 12:39:23PM +0000, Luca Boccassi wrote:
> > On Fri, 2019-01-11 at 11:52 +0000, Bruce Richardson wrote:
> > > On Fri, Jan 11, 2019 at 11:10:28AM +0000, Luca Boccassi wrote:
> > > > On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> > > > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi
> > > > > wrote:
> > > > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > > > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi
> > > > > > > wrote:
> > > > > > > > For libbsd, which is checked in a top level file and
> > > > > > > > used
> > > > > > > > to be
> > > > > > > > added
> > > > > > > > to the global linker flags array, add it to the
> > > > > > > > ext_deps
> > > > > > > > array
> > > > > > > > of
> > > > > > > > all top level meson files (app, test, lib, examples,
> > > > > > > > drivers).
> > > > > > > > The
> > > > > > > > most correct change would be to let each individual
> > > > > > > > library/driver/app
> > > > > > > > depend on it individually if they use symbols from it,
> > > > > > > > but
> > > > > > > > it
> > > > > > > > would
> > > > > > > > diverge from the legacy Makefile's behaviour and make
> > > > > > > > life
> > > > > > > > a
> > > > > > > > bit
> > > > > > > > more
> > > > > > > > difficult for contributors.
> > > > > > > 
> > > > > > > It shouldn't be necessary to add libbsd as a dependency
> > > > > > > for
> > > > > > > everything. I
> > > > > > > think just adding it as a dependency of EAL should work
> > > > > > > fine. 
> > > > > > 
> > > > > > Won't that mean that the shared libraries other than EAL
> > > > > > will
> > > > > > have
> > > > > > undefined references?
> > > > > 
> > > > > Should not happen. AFAIK when you link against a library in
> > > > > meson
> > > > > it
> > > > > will
> > > > > also link against any of that libraries dependencies too. For
> > > > > shared
> > > > > libraries meson always disallowed undefined references in the
> > > > > linker
> > > > > commandline. [To have libs with undefined refs, e.g. plugins,
> > > > > you
> > > > > need to
> > > > > use "shared_module" rather than "shared_library" command].
> > > > 
> > > > Looked at this again, and rte_cmdline is using strlcpy as well,
> > > > and
> > > > it's built before rte_eal, so it fails:
> > > > 
> > > > lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c.o:
> > > > In
> > > > function `cmdline_complete':
> > > > cmdline_parse.c:(.text+0x861): undefined reference to `strlcpy'
> > > > 
> > > > Adding it to ext_deps in both rte_cmdline and rte_eal works. Is
> > > > that an acceptable compromise?
> > > > 
> > > 
> > > Sure. If eal has a dependency on cmdline, you probably don't need
> > > to
> > > add it
> > > as an external dependency to EAL too, but it doesn't really hurt
> > > to
> > > do so.
> > > 
> > > /Bruce
> > 
> > eal does not depend on cmdline, so added in both in v2. I also
> > split
> > the libbsd change and meson bump to 0.47.1 in a separate commit in
> > the
> > series.
> > 
> > -- 
> 
> If there is no dependency, why is it being built first?

Comment says "ethdev depends on cmdline for parsing functions"

https://git.dpdk.org/dpdk/tree/lib/meson.build#n12

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd
  2019-01-11 14:30       ` Bruce Richardson
@ 2019-01-11 15:04         ` Luca Boccassi
  2019-01-11 15:50           ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 15:04 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Fri, 2019-01-11 at 14:30 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > > Move libbsd inclusion to librte_eal, so that all other libraries
> > > and
> > > PMDs will inherit it, and librte_cmdline which is built before
> > > librte_eal.
> > > Bump Meson dependency to 0.47.1, to avoid bug where the linker
> > > flag of
> > > the dependency gets replicated again and again.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > ---
> > > v2: bump meson minimum version to 0.47.1 to avoid meson bug, and
> > > move
> > >     libbsd dependency to eal and cmdline
> > > 
> > >  config/meson.build             | 10 +++++-----
> > >  lib/librte_cmdline/meson.build |  4 ++++
> > >  lib/librte_eal/meson.build     |  3 +++
> > >  meson.build                    |  2 +-
> > >  4 files changed, 13 insertions(+), 6 deletions(-)
> > > 
> > 
> > There are some meson version checks in the code that can be removed
> > as
> > part of this change:
> > 
> > $ git grep meson.version
> > drivers/meson.build:    if
> > meson.version().version_compare('>=0.47')
> > kernel/linux/meson.build:       if
> > meson.version().version_compare('>=0.44')
> > kernel/linux/meson.build:               if
> > meson.version().version_compare('>=0.44')
> > meson.build:    meson_version: '>= 0.41'
> > meson.build:if meson.version().version_compare('>=0.47')
> > 
> 
> Thinking on this more, I think the version bump to 0.47 should be
> done in a
> separate standalone patch at the start of this set. Then the other
> patches
> can be based on that.
> 
> /Bruce

Ok, will remove those checks in v3 and move the bump to a different
patch. I'll put it second, as the first patch is really not related to
the version and it's stand-alone (and marked for stable), I was just
too lazy to do 2 series :-)

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-11 14:56                 ` Luca Boccassi
@ 2019-01-11 15:49                   ` Bruce Richardson
  2019-01-11 16:27                     ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 15:49 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, stable

On Fri, Jan 11, 2019 at 02:56:28PM +0000, Luca Boccassi wrote:
> On Fri, 2019-01-11 at 14:24 +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 12:39:23PM +0000, Luca Boccassi wrote:
> > > On Fri, 2019-01-11 at 11:52 +0000, Bruce Richardson wrote:
> > > > On Fri, Jan 11, 2019 at 11:10:28AM +0000, Luca Boccassi wrote:
> > > > > On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> > > > > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi
> > > > > > wrote:
> > > > > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson wrote:
> > > > > > > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca Boccassi
> > > > > > > > wrote:
> > > > > > > > > For libbsd, which is checked in a top level file and
> > > > > > > > > used
> > > > > > > > > to be
> > > > > > > > > added
> > > > > > > > > to the global linker flags array, add it to the
> > > > > > > > > ext_deps
> > > > > > > > > array
> > > > > > > > > of
> > > > > > > > > all top level meson files (app, test, lib, examples,
> > > > > > > > > drivers).
> > > > > > > > > The
> > > > > > > > > most correct change would be to let each individual
> > > > > > > > > library/driver/app
> > > > > > > > > depend on it individually if they use symbols from it,
> > > > > > > > > but
> > > > > > > > > it
> > > > > > > > > would
> > > > > > > > > diverge from the legacy Makefile's behaviour and make
> > > > > > > > > life
> > > > > > > > > a
> > > > > > > > > bit
> > > > > > > > > more
> > > > > > > > > difficult for contributors.
> > > > > > > > 
> > > > > > > > It shouldn't be necessary to add libbsd as a dependency
> > > > > > > > for
> > > > > > > > everything. I
> > > > > > > > think just adding it as a dependency of EAL should work
> > > > > > > > fine. 
> > > > > > > 
> > > > > > > Won't that mean that the shared libraries other than EAL
> > > > > > > will
> > > > > > > have
> > > > > > > undefined references?
> > > > > > 
> > > > > > Should not happen. AFAIK when you link against a library in
> > > > > > meson
> > > > > > it
> > > > > > will
> > > > > > also link against any of that libraries dependencies too. For
> > > > > > shared
> > > > > > libraries meson always disallowed undefined references in the
> > > > > > linker
> > > > > > commandline. [To have libs with undefined refs, e.g. plugins,
> > > > > > you
> > > > > > need to
> > > > > > use "shared_module" rather than "shared_library" command].
> > > > > 
> > > > > Looked at this again, and rte_cmdline is using strlcpy as well,
> > > > > and
> > > > > it's built before rte_eal, so it fails:
> > > > > 
> > > > > lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c.o:
> > > > > In
> > > > > function `cmdline_complete':
> > > > > cmdline_parse.c:(.text+0x861): undefined reference to `strlcpy'
> > > > > 
> > > > > Adding it to ext_deps in both rte_cmdline and rte_eal works. Is
> > > > > that an acceptable compromise?
> > > > > 
> > > > 
> > > > Sure. If eal has a dependency on cmdline, you probably don't need
> > > > to
> > > > add it
> > > > as an external dependency to EAL too, but it doesn't really hurt
> > > > to
> > > > do so.
> > > > 
> > > > /Bruce
> > > 
> > > eal does not depend on cmdline, so added in both in v2. I also
> > > split
> > > the libbsd change and meson bump to 0.47.1 in a separate commit in
> > > the
> > > series.
> > > 
> > > -- 
> > 
> > If there is no dependency, why is it being built first?
> 
> Comment says "ethdev depends on cmdline for parsing functions"
> 
> https://git.dpdk.org/dpdk/tree/lib/meson.build#n12
> 
> -- 
So it looks like it could be placed between EAL and ethdev. Not a bit deal
either way, so I'm happy enough to leave it as-is for now.

/Bruce

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

* Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd
  2019-01-11 15:04         ` Luca Boccassi
@ 2019-01-11 15:50           ` Bruce Richardson
  2019-01-11 16:14             ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 15:50 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 03:04:38PM +0000, Luca Boccassi wrote:
> On Fri, 2019-01-11 at 14:30 +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> > > On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > > > Move libbsd inclusion to librte_eal, so that all other libraries
> > > > and
> > > > PMDs will inherit it, and librte_cmdline which is built before
> > > > librte_eal.
> > > > Bump Meson dependency to 0.47.1, to avoid bug where the linker
> > > > flag of
> > > > the dependency gets replicated again and again.
> > > > 
> > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > ---
> > > > v2: bump meson minimum version to 0.47.1 to avoid meson bug, and
> > > > move
> > > >     libbsd dependency to eal and cmdline
> > > > 
> > > >  config/meson.build             | 10 +++++-----
> > > >  lib/librte_cmdline/meson.build |  4 ++++
> > > >  lib/librte_eal/meson.build     |  3 +++
> > > >  meson.build                    |  2 +-
> > > >  4 files changed, 13 insertions(+), 6 deletions(-)
> > > > 
> > > 
> > > There are some meson version checks in the code that can be removed
> > > as
> > > part of this change:
> > > 
> > > $ git grep meson.version
> > > drivers/meson.build:    if
> > > meson.version().version_compare('>=0.47')
> > > kernel/linux/meson.build:       if
> > > meson.version().version_compare('>=0.44')
> > > kernel/linux/meson.build:               if
> > > meson.version().version_compare('>=0.44')
> > > meson.build:    meson_version: '>= 0.41'
> > > meson.build:if meson.version().version_compare('>=0.47')
> > > 
> > 
> > Thinking on this more, I think the version bump to 0.47 should be
> > done in a
> > separate standalone patch at the start of this set. Then the other
> > patches
> > can be based on that.
> > 
> > /Bruce
> 
> Ok, will remove those checks in v3 and move the bump to a different
> patch. I'll put it second, as the first patch is really not related to
> the version and it's stand-alone (and marked for stable), I was just
> too lazy to do 2 series :-)
> 
> -- 
> Kind regards,
> Luca Boccassi

I don't expect the version bump to happen for 19.02, so if you want the
first patch to go into that release, it probably needs to be standalone.

/Bruce

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

* Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd
  2019-01-11 15:50           ` Bruce Richardson
@ 2019-01-11 16:14             ` Luca Boccassi
  0 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 16:14 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Fri, 2019-01-11 at 15:50 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 03:04:38PM +0000, Luca Boccassi wrote:
> > On Fri, 2019-01-11 at 14:30 +0000, Bruce Richardson wrote:
> > > On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> > > > On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > > > > Move libbsd inclusion to librte_eal, so that all other
> > > > > libraries
> > > > > and
> > > > > PMDs will inherit it, and librte_cmdline which is built
> > > > > before
> > > > > librte_eal.
> > > > > Bump Meson dependency to 0.47.1, to avoid bug where the
> > > > > linker
> > > > > flag of
> > > > > the dependency gets replicated again and again.
> > > > > 
> > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > ---
> > > > > v2: bump meson minimum version to 0.47.1 to avoid meson bug,
> > > > > and
> > > > > move
> > > > >     libbsd dependency to eal and cmdline
> > > > > 
> > > > >  config/meson.build             | 10 +++++-----
> > > > >  lib/librte_cmdline/meson.build |  4 ++++
> > > > >  lib/librte_eal/meson.build     |  3 +++
> > > > >  meson.build                    |  2 +-
> > > > >  4 files changed, 13 insertions(+), 6 deletions(-)
> > > > > 
> > > > 
> > > > There are some meson version checks in the code that can be
> > > > removed
> > > > as
> > > > part of this change:
> > > > 
> > > > $ git grep meson.version
> > > > drivers/meson.build:    if
> > > > meson.version().version_compare('>=0.47')
> > > > kernel/linux/meson.build:       if
> > > > meson.version().version_compare('>=0.44')
> > > > kernel/linux/meson.build:               if
> > > > meson.version().version_compare('>=0.44')
> > > > meson.build:    meson_version: '>= 0.41'
> > > > meson.build:if meson.version().version_compare('>=0.47')
> > > > 
> > > 
> > > Thinking on this more, I think the version bump to 0.47 should be
> > > done in a
> > > separate standalone patch at the start of this set. Then the
> > > other
> > > patches
> > > can be based on that.
> > > 
> > > /Bruce
> > 
> > Ok, will remove those checks in v3 and move the bump to a different
> > patch. I'll put it second, as the first patch is really not related
> > to
> > the version and it's stand-alone (and marked for stable), I was
> > just
> > too lazy to do 2 series :-)
> > 
> > -- 
> > Kind regards,
> > Luca Boccassi
> 
> I don't expect the version bump to happen for 19.02, so if you want
> the
> first patch to go into that release, it probably needs to be
> standalone.
> 
> /Bruce

Ok, will do that.

-- 
Kind regards,
Luca Boccassi

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

* [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
  2019-01-03 17:57 ` [PATCH 2/2] build: use dependency() instead of find_library() Luca Boccassi
  2019-01-11 12:38 ` [PATCH v2 1/3] build: use static deps of libs for pkg-config libs.private Luca Boccassi
@ 2019-01-11 16:26 ` Luca Boccassi
  2019-01-11 16:26   ` [PATCH v3 2/4] build: use dependency() instead of find_library() Luca Boccassi
                     ` (3 more replies)
  2019-01-11 18:22 ` [PATCH v4 " Luca Boccassi
                   ` (4 subsequent siblings)
  7 siblings, 4 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 16:26 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Meson 0.47.1 fixed a bug that is difficult to work around, which causes
the linker flag of dependencies to be repeated dozens of times, which
causes issues especially when using the built-in dependency() API.
Bump the minimum version and remove obsolete version checks.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug
v3: split away first independent patch from series

 drivers/meson.build      |  5 +----
 kernel/linux/meson.build |  6 +-----
 meson.build              | 35 +++++++++++++++--------------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..e37d4fe2b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -148,8 +148,5 @@ foreach class:driver_classes
 		endif # build
 	endforeach
 
-	if meson.version().version_compare('>=0.47')
-		# prior to 0.47, set_variable can't take array params
-		set_variable(class + '_drivers', class_drivers)
-	endif
+	set_variable(class + '_drivers', class_drivers)
 endforeach
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index 5b7ec06e1..d751d939f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -27,11 +27,7 @@ else
 	make_returncode = run_command('make', '-sC', kernel_dir,
 			'kernelversion').returncode()
 	if make_returncode != 0
-		if meson.version().version_compare('>=0.44')
-			warning(WARN_NO_HEADERS)
-		else
-			message('WARNING: ' + WARN_NO_HEADERS)
-		endif
+		warning(WARN_NO_HEADERS)
 	else # returncode == 0
 
 # DO ACTUAL MODULE BUILDING
diff --git a/meson.build b/meson.build
index d500507c5..d0534dc0d 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.02.0-rc1',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
@@ -105,23 +105,18 @@ foreach lib:enabled_libs
 endforeach
 message(output_message + '\n')
 
-
-# prior to 0.47 set_variable didn't work with arrays, so we can't
-# track driver lists easily
-if meson.version().version_compare('>=0.47')
-	output_message = '\n===============\nDrivers Enabled\n===============\n'
-	foreach class:driver_classes
-		class_drivers = get_variable(class + '_drivers')
-		output_message += '\n' + class + ':\n\t'
-		output_count = 0
-		foreach drv:class_drivers
-			output_message += drv + ', '
-			output_count += 1
-			if output_count == 8
-				output_message += '\n\t'
-				output_count = 0
-			endif
-		endforeach
+output_message = '\n===============\nDrivers Enabled\n===============\n'
+foreach class:driver_classes
+	class_drivers = get_variable(class + '_drivers')
+	output_message += '\n' + class + ':\n\t'
+	output_count = 0
+	foreach drv:class_drivers
+		output_message += drv + ', '
+		output_count += 1
+		if output_count == 8
+			output_message += '\n\t'
+			output_count = 0
+		endif
 	endforeach
-	message(output_message + '\n')
-endif
+endforeach
+message(output_message + '\n')
-- 
2.20.1

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

* [PATCH v3 2/4] build: use dependency() instead of find_library()
  2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
@ 2019-01-11 16:26   ` Luca Boccassi
  2019-01-11 17:21     ` Bruce Richardson
  2019-01-11 16:26   ` [PATCH v3 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 16:26 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluos and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required

 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 2 +-
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 drivers/net/pcap/meson.build       | 5 ++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 10 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index c2a0dd8ba..80e5e8835 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -8,4 +8,3 @@ endif
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index e37d4fe2b..d17ca76eb 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,7 +46,7 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
+		# using dependency() (preferred) or find_library(). For most cases, we
 		# probably also need to specify the "-l" flags in
 		# pkgconfig_extra_libs variable too, so that it can be reflected
 		# in the pkgconfig output for static builds
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 7de571e2a..4ba4e93b6 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 8ba19e818..161c5641f 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..89c9d7a74 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
 	build = false
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
-- 
2.20.1

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

* [PATCH v3 3/4] build: reorder libraries and build eal before cmdline
  2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-01-11 16:26   ` [PATCH v3 2/4] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-11 16:26   ` Luca Boccassi
  2019-01-11 17:22     ` Bruce Richardson
  2019-01-11 16:26   ` [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
  2019-01-11 17:17   ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Bruce Richardson
  3 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 16:26 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Most libraries and PMDs depend on eal, and eal depends only on kvargs,
so reorder the list in Meson to reflect this and take advantage of this
dependency chain.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v3: added this patch to let the next just update librte_eal instead of
    also having to update rte_cmdline

 lib/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index a2dd52e17..bf8417c6d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,9 +9,10 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [ 'compat', # just a header, used for versioning
-	'cmdline', # ethdev depends on cmdline for parsing functions
 	'kvargs', # eal depends on kvargs
-	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
+	'eal', # everything depends on eal
+	'cmdline', # ethdev depends on cmdline for parsing functions
+	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
 	'metrics', # bitrate/latency stats depends on this
 	'hash',    # efd depends on this
 	'timer',   # eventdev depends on this
-- 
2.20.1

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

* [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags
  2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-01-11 16:26   ` [PATCH v3 2/4] build: use dependency() instead of find_library() Luca Boccassi
  2019-01-11 16:26   ` [PATCH v3 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
@ 2019-01-11 16:26   ` Luca Boccassi
  2019-01-11 17:24     ` Bruce Richardson
  2019-01-11 17:17   ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Bruce Richardson
  3 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 16:26 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v3: only add dependency to librte_eal and let it propagate from there

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@ version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
-- 
2.20.1

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

* Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()
  2019-01-11 15:49                   ` Bruce Richardson
@ 2019-01-11 16:27                     ` Luca Boccassi
  0 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 16:27 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

On Fri, 2019-01-11 at 15:49 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 02:56:28PM +0000, Luca Boccassi wrote:
> > On Fri, 2019-01-11 at 14:24 +0000, Bruce Richardson wrote:
> > > On Fri, Jan 11, 2019 at 12:39:23PM +0000, Luca Boccassi wrote:
> > > > On Fri, 2019-01-11 at 11:52 +0000, Bruce Richardson wrote:
> > > > > On Fri, Jan 11, 2019 at 11:10:28AM +0000, Luca Boccassi
> > > > > wrote:
> > > > > > On Mon, 2019-01-07 at 16:55 +0000, Bruce Richardson wrote:
> > > > > > > On Mon, Jan 07, 2019 at 04:39:34PM +0000, Luca Boccassi
> > > > > > > wrote:
> > > > > > > > On Mon, 2019-01-07 at 14:28 +0000, Bruce Richardson
> > > > > > > > wrote:
> > > > > > > > > On Thu, Jan 03, 2019 at 06:57:25PM +0100, Luca
> > > > > > > > > Boccassi
> > > > > > > > > wrote:
> > > > > > > > > > For libbsd, which is checked in a top level file
> > > > > > > > > > and
> > > > > > > > > > used
> > > > > > > > > > to be
> > > > > > > > > > added
> > > > > > > > > > to the global linker flags array, add it to the
> > > > > > > > > > ext_deps
> > > > > > > > > > array
> > > > > > > > > > of
> > > > > > > > > > all top level meson files (app, test, lib,
> > > > > > > > > > examples,
> > > > > > > > > > drivers).
> > > > > > > > > > The
> > > > > > > > > > most correct change would be to let each individual
> > > > > > > > > > library/driver/app
> > > > > > > > > > depend on it individually if they use symbols from
> > > > > > > > > > it,
> > > > > > > > > > but
> > > > > > > > > > it
> > > > > > > > > > would
> > > > > > > > > > diverge from the legacy Makefile's behaviour and
> > > > > > > > > > make
> > > > > > > > > > life
> > > > > > > > > > a
> > > > > > > > > > bit
> > > > > > > > > > more
> > > > > > > > > > difficult for contributors.
> > > > > > > > > 
> > > > > > > > > It shouldn't be necessary to add libbsd as a
> > > > > > > > > dependency
> > > > > > > > > for
> > > > > > > > > everything. I
> > > > > > > > > think just adding it as a dependency of EAL should
> > > > > > > > > work
> > > > > > > > > fine. 
> > > > > > > > 
> > > > > > > > Won't that mean that the shared libraries other than
> > > > > > > > EAL
> > > > > > > > will
> > > > > > > > have
> > > > > > > > undefined references?
> > > > > > > 
> > > > > > > Should not happen. AFAIK when you link against a library
> > > > > > > in
> > > > > > > meson
> > > > > > > it
> > > > > > > will
> > > > > > > also link against any of that libraries dependencies too.
> > > > > > > For
> > > > > > > shared
> > > > > > > libraries meson always disallowed undefined references in
> > > > > > > the
> > > > > > > linker
> > > > > > > commandline. [To have libs with undefined refs, e.g.
> > > > > > > plugins,
> > > > > > > you
> > > > > > > need to
> > > > > > > use "shared_module" rather than "shared_library"
> > > > > > > command].
> > > > > > 
> > > > > > Looked at this again, and rte_cmdline is using strlcpy as
> > > > > > well,
> > > > > > and
> > > > > > it's built before rte_eal, so it fails:
> > > > > > 
> > > > > > lib/76b5a35@@rte_cmdline@sta/librte_cmdline_cmdline_parse.c
> > > > > > .o:
> > > > > > In
> > > > > > function `cmdline_complete':
> > > > > > cmdline_parse.c:(.text+0x861): undefined reference to
> > > > > > `strlcpy'
> > > > > > 
> > > > > > Adding it to ext_deps in both rte_cmdline and rte_eal
> > > > > > works. Is
> > > > > > that an acceptable compromise?
> > > > > > 
> > > > > 
> > > > > Sure. If eal has a dependency on cmdline, you probably don't
> > > > > need
> > > > > to
> > > > > add it
> > > > > as an external dependency to EAL too, but it doesn't really
> > > > > hurt
> > > > > to
> > > > > do so.
> > > > > 
> > > > > /Bruce
> > > > 
> > > > eal does not depend on cmdline, so added in both in v2. I also
> > > > split
> > > > the libbsd change and meson bump to 0.47.1 in a separate commit
> > > > in
> > > > the
> > > > series.
> > > > 
> > > > -- 
> > > 
> > > If there is no dependency, why is it being built first?
> > 
> > Comment says "ethdev depends on cmdline for parsing functions"
> > 
> > https://git.dpdk.org/dpdk/tree/lib/meson.build#n12
> > 
> > -- 
> 
> So it looks like it could be placed between EAL and ethdev. Not a bit
> deal
> either way, so I'm happy enough to leave it as-is for now.
> 
> /Bruce

Reordering seems to work just fine, so I'll just go ahead and add
another patch for it in v3.

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1
  2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
                     ` (2 preceding siblings ...)
  2019-01-11 16:26   ` [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
@ 2019-01-11 17:17   ` Bruce Richardson
  3 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 17:17 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 04:26:05PM +0000, Luca Boccassi wrote:
> Meson 0.47.1 fixed a bug that is difficult to work around, which causes
> the linker flag of dependencies to be repeated dozens of times, which
> causes issues especially when using the built-in dependency() API.
> Bump the minimum version and remove obsolete version checks.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: bump meson minimum version to 0.47.1 to avoid meson bug
> v3: split away first independent patch from series
> 
>  drivers/meson.build      |  5 +----
>  kernel/linux/meson.build |  6 +-----
>  meson.build              | 35 +++++++++++++++--------------------
>  3 files changed, 17 insertions(+), 29 deletions(-)
> 
This looks ok to me.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [PATCH v3 2/4] build: use dependency() instead of find_library()
  2019-01-11 16:26   ` [PATCH v3 2/4] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-11 17:21     ` Bruce Richardson
  2019-01-11 18:16       ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 17:21 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 04:26:06PM +0000, Luca Boccassi wrote:
> Whenever possible (if the library ships a pkg-config file) use meson's
> dependency() function to look for it, as it will automatically add it
> to the Requires.private list if needed, to allow for static builds to
> succeed for reverse dependencies of DPDK. Otherwise the recursive
> dependencies are not parsed, and users doing static builds have to
> resolve them manually by themselves.
> When using this API avoid additional checks that are superfluos and

Spelling: superfluous

> take extra time, and avoid adding the linker flag manually which causes
> it to be duplicated.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: split libbsd change in a separate commit, remove CC to stable
>     as a meson bump will be required
> 
>  drivers/crypto/ccp/meson.build     | 1 -
>  drivers/crypto/openssl/meson.build | 1 -
>  drivers/crypto/qat/meson.build     | 1 -
>  drivers/meson.build                | 2 +-
>  drivers/net/bnx2x/meson.build      | 2 +-
>  drivers/net/mlx4/meson.build       | 6 +++---
>  drivers/net/mlx5/meson.build       | 6 +++---
>  drivers/net/pcap/meson.build       | 5 ++---
>  lib/librte_bpf/meson.build         | 4 ++--
>  lib/librte_telemetry/meson.build   | 2 +-
>  10 files changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
> index e43b00591..915c4c854 100644
> --- a/drivers/crypto/ccp/meson.build
> +++ b/drivers/crypto/ccp/meson.build
> @@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
>  		'ccp_pmd_ops.c')
>  
>  ext_deps += dep
> -pkgconfig_extra_libs += '-lcrypto'
> diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
> index c2a0dd8ba..80e5e8835 100644
> --- a/drivers/crypto/openssl/meson.build
> +++ b/drivers/crypto/openssl/meson.build
> @@ -8,4 +8,3 @@ endif
>  deps += 'bus_vdev'
>  sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
>  ext_deps += dep
> -pkgconfig_extra_libs += '-lcrypto'
> diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
> index 9cc98d2c2..21f969735 100644
> --- a/drivers/crypto/qat/meson.build
> +++ b/drivers/crypto/qat/meson.build
> @@ -13,6 +13,5 @@ if dep.found()
>  			     'qat_sym.c',
>  			     'qat_sym_session.c')
>  	qat_ext_deps += dep
> -	pkgconfig_extra_libs += '-lcrypto'
>  	qat_cflags += '-DBUILD_QAT_SYM'
>  endif
> diff --git a/drivers/meson.build b/drivers/meson.build
> index e37d4fe2b..d17ca76eb 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -46,7 +46,7 @@ foreach class:driver_classes
>  		# set up internal deps. Drivers can append/override as necessary
>  		deps = std_deps
>  		# ext_deps: Stores external library dependency got
> -		# using dependency() or cc.find_library(). For most cases, we
> +		# using dependency() (preferred) or find_library(). For most cases, we
>  		# probably also need to specify the "-l" flags in
>  		# pkgconfig_extra_libs variable too, so that it can be reflected
>  		# in the pkgconfig output for static builds

The last part of this comment can now be deleted, right? If we use
dependency() we don't need to use pkgconfig_extra_libs.

Is the pkgconfig_extra_libs variable still needed after these changes?

/Bruce

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

* Re: [PATCH v3 3/4] build: reorder libraries and build eal before cmdline
  2019-01-11 16:26   ` [PATCH v3 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
@ 2019-01-11 17:22     ` Bruce Richardson
  0 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 17:22 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 04:26:07PM +0000, Luca Boccassi wrote:
> Most libraries and PMDs depend on eal, and eal depends only on kvargs,
> so reorder the list in Meson to reflect this and take advantage of this
> dependency chain.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v3: added this patch to let the next just update librte_eal instead of
>     also having to update rte_cmdline
> 
>  lib/meson.build | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/meson.build b/lib/meson.build
> index a2dd52e17..bf8417c6d 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -9,9 +9,10 @@
>  # given as a dep, no need to mention ring. This is especially true for the
>  # core libs which are widely reused, so their deps are kept to a minimum.
>  libraries = [ 'compat', # just a header, used for versioning
> -	'cmdline', # ethdev depends on cmdline for parsing functions
>  	'kvargs', # eal depends on kvargs
> -	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
> +	'eal', # everything depends on eal
> +	'cmdline', # ethdev depends on cmdline for parsing functions
> +	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
>  	'metrics', # bitrate/latency stats depends on this
>  	'hash',    # efd depends on this
>  	'timer',   # eventdev depends on this

This is a saner build order, so

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags
  2019-01-11 16:26   ` [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
@ 2019-01-11 17:24     ` Bruce Richardson
  0 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 17:24 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 04:26:08PM +0000, Luca Boccassi wrote:
> Move libbsd inclusion to librte_eal, so that all other libraries and
> PMDs will inherit it.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v3: only add dependency to librte_eal and let it propagate from there
> 
>  config/meson.build         | 10 +++++-----
>  lib/librte_eal/meson.build |  3 +++
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [PATCH v3 2/4] build: use dependency() instead of find_library()
  2019-01-11 17:21     ` Bruce Richardson
@ 2019-01-11 18:16       ` Luca Boccassi
  2019-01-11 21:49         ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 18:16 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Fri, 2019-01-11 at 17:21 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 04:26:06PM +0000, Luca Boccassi wrote:
> > Whenever possible (if the library ships a pkg-config file) use
> > meson's
> > dependency() function to look for it, as it will automatically add
> > it
> > to the Requires.private list if needed, to allow for static builds
> > to
> > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > dependencies are not parsed, and users doing static builds have to
> > resolve them manually by themselves.
> > When using this API avoid additional checks that are superfluos and
> 
> Spelling: superfluous

I _always_ get that one wrong :-)

> > take extra time, and avoid adding the linker flag manually which
> > causes
> > it to be duplicated.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > v2: split libbsd change in a separate commit, remove CC to stable
> >     as a meson bump will be required
> > 
> >  drivers/crypto/ccp/meson.build     | 1 -
> >  drivers/crypto/openssl/meson.build | 1 -
> >  drivers/crypto/qat/meson.build     | 1 -
> >  drivers/meson.build                | 2 +-
> >  drivers/net/bnx2x/meson.build      | 2 +-
> >  drivers/net/mlx4/meson.build       | 6 +++---
> >  drivers/net/mlx5/meson.build       | 6 +++---
> >  drivers/net/pcap/meson.build       | 5 ++---
> >  lib/librte_bpf/meson.build         | 4 ++--
> >  lib/librte_telemetry/meson.build   | 2 +-
> >  10 files changed, 13 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/crypto/ccp/meson.build
> > b/drivers/crypto/ccp/meson.build
> > index e43b00591..915c4c854 100644
> > --- a/drivers/crypto/ccp/meson.build
> > +++ b/drivers/crypto/ccp/meson.build
> > @@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
> >  		'ccp_pmd_ops.c')
> >  
> >  ext_deps += dep
> > -pkgconfig_extra_libs += '-lcrypto'
> > diff --git a/drivers/crypto/openssl/meson.build
> > b/drivers/crypto/openssl/meson.build
> > index c2a0dd8ba..80e5e8835 100644
> > --- a/drivers/crypto/openssl/meson.build
> > +++ b/drivers/crypto/openssl/meson.build
> > @@ -8,4 +8,3 @@ endif
> >  deps += 'bus_vdev'
> >  sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
> >  ext_deps += dep
> > -pkgconfig_extra_libs += '-lcrypto'
> > diff --git a/drivers/crypto/qat/meson.build
> > b/drivers/crypto/qat/meson.build
> > index 9cc98d2c2..21f969735 100644
> > --- a/drivers/crypto/qat/meson.build
> > +++ b/drivers/crypto/qat/meson.build
> > @@ -13,6 +13,5 @@ if dep.found()
> >  			     'qat_sym.c',
> >  			     'qat_sym_session.c')
> >  	qat_ext_deps += dep
> > -	pkgconfig_extra_libs += '-lcrypto'
> >  	qat_cflags += '-DBUILD_QAT_SYM'
> >  endif
> > diff --git a/drivers/meson.build b/drivers/meson.build
> > index e37d4fe2b..d17ca76eb 100644
> > --- a/drivers/meson.build
> > +++ b/drivers/meson.build
> > @@ -46,7 +46,7 @@ foreach class:driver_classes
> >  		# set up internal deps. Drivers can
> > append/override as necessary
> >  		deps = std_deps
> >  		# ext_deps: Stores external library dependency got
> > -		# using dependency() or cc.find_library(). For
> > most cases, we
> > +		# using dependency() (preferred) or
> > find_library(). For most cases, we
> >  		# probably also need to specify the "-l" flags in
> >  		# pkgconfig_extra_libs variable too, so that it
> > can be reflected
> >  		# in the pkgconfig output for static builds
> 
> The last part of this comment can now be deleted, right? If we use
> dependency() we don't need to use pkgconfig_extra_libs.
> 
> Is the pkgconfig_extra_libs variable still needed after these
> changes?
> 
> /Bruce

Yes, as we can't use dependency() for everything unfortunately - only
for those projects that ship a pkg-config file, a cmake file or that
Meson has built-in knowledge of (like llvm or libpcap).
I'll update that comment accordingly in v4.

-- 
Kind regards,
Luca Boccassi

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

* [PATCH v4 1/4] build: bump minimum Meson version to 0.47.1
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
                   ` (2 preceding siblings ...)
  2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
@ 2019-01-11 18:22 ` Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 2/4] build: use dependency() instead of find_library() Luca Boccassi
                     ` (2 more replies)
  2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
                   ` (3 subsequent siblings)
  7 siblings, 3 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 18:22 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Meson 0.47.1 fixed a bug that is difficult to work around, which causes
the linker flag of dependencies to be repeated dozens of times, which
causes issues especially when using the built-in dependency() API.
Bump the minimum version and remove obsolete version checks.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug
v3: split away first independent patch from series
v4: add acked-by

 drivers/meson.build      |  5 +----
 kernel/linux/meson.build |  6 +-----
 meson.build              | 35 +++++++++++++++--------------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..e37d4fe2b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -148,8 +148,5 @@ foreach class:driver_classes
 		endif # build
 	endforeach
 
-	if meson.version().version_compare('>=0.47')
-		# prior to 0.47, set_variable can't take array params
-		set_variable(class + '_drivers', class_drivers)
-	endif
+	set_variable(class + '_drivers', class_drivers)
 endforeach
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index 5b7ec06e1..d751d939f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -27,11 +27,7 @@ else
 	make_returncode = run_command('make', '-sC', kernel_dir,
 			'kernelversion').returncode()
 	if make_returncode != 0
-		if meson.version().version_compare('>=0.44')
-			warning(WARN_NO_HEADERS)
-		else
-			message('WARNING: ' + WARN_NO_HEADERS)
-		endif
+		warning(WARN_NO_HEADERS)
 	else # returncode == 0
 
 # DO ACTUAL MODULE BUILDING
diff --git a/meson.build b/meson.build
index d500507c5..d0534dc0d 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.02.0-rc1',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
@@ -105,23 +105,18 @@ foreach lib:enabled_libs
 endforeach
 message(output_message + '\n')
 
-
-# prior to 0.47 set_variable didn't work with arrays, so we can't
-# track driver lists easily
-if meson.version().version_compare('>=0.47')
-	output_message = '\n===============\nDrivers Enabled\n===============\n'
-	foreach class:driver_classes
-		class_drivers = get_variable(class + '_drivers')
-		output_message += '\n' + class + ':\n\t'
-		output_count = 0
-		foreach drv:class_drivers
-			output_message += drv + ', '
-			output_count += 1
-			if output_count == 8
-				output_message += '\n\t'
-				output_count = 0
-			endif
-		endforeach
+output_message = '\n===============\nDrivers Enabled\n===============\n'
+foreach class:driver_classes
+	class_drivers = get_variable(class + '_drivers')
+	output_message += '\n' + class + ':\n\t'
+	output_count = 0
+	foreach drv:class_drivers
+		output_message += drv + ', '
+		output_count += 1
+		if output_count == 8
+			output_message += '\n\t'
+			output_count = 0
+		endif
 	endforeach
-	message(output_message + '\n')
-endif
+endforeach
+message(output_message + '\n')
-- 
2.20.1

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

* [PATCH v4 2/4] build: use dependency() instead of find_library()
  2019-01-11 18:22 ` [PATCH v4 " Luca Boccassi
@ 2019-01-11 18:22   ` Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
  2 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 18:22 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluous and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required
v4: update comment in drivers/meson.build to clarify role of
    pkgconfig_extra_libs

 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 9 +++++----
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 drivers/net/pcap/meson.build       | 5 ++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 10 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index c2a0dd8ba..80e5e8835 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -8,4 +8,3 @@ endif
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index e37d4fe2b..69d0556d3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,10 +46,11 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
-		# probably also need to specify the "-l" flags in
-		# pkgconfig_extra_libs variable too, so that it can be reflected
-		# in the pkgconfig output for static builds
+		# using dependency() (preferred) or find_library().
+		# For the find_library() case (but not with dependency()) we also
+		# need to specify the "-l" flags in pkgconfig_extra_libs variable
+		# too, so that it can be reflected in the pkgconfig output for
+		# static builds.
 		ext_deps = []
 		pkgconfig_extra_libs = []
 
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 7de571e2a..4ba4e93b6 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 8ba19e818..161c5641f 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..89c9d7a74 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
 	build = false
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
-- 
2.20.1

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

* [PATCH v4 3/4] build: reorder libraries and build eal before cmdline
  2019-01-11 18:22 ` [PATCH v4 " Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 2/4] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-11 18:22   ` Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
  2 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 18:22 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Most libraries and PMDs depend on eal, and eal depends only on kvargs,
so reorder the list in Meson to reflect this and take advantage of this
dependency chain.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: added this patch to let the next just update librte_eal instead of
    also having to update rte_cmdline
v4: add acked-by

 lib/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index a2dd52e17..bf8417c6d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,9 +9,10 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [ 'compat', # just a header, used for versioning
-	'cmdline', # ethdev depends on cmdline for parsing functions
 	'kvargs', # eal depends on kvargs
-	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
+	'eal', # everything depends on eal
+	'cmdline', # ethdev depends on cmdline for parsing functions
+	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
 	'metrics', # bitrate/latency stats depends on this
 	'hash',    # efd depends on this
 	'timer',   # eventdev depends on this
-- 
2.20.1

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

* [PATCH v4 4/4] build: use dependency() for libbsd instead of manual append to ldflags
  2019-01-11 18:22 ` [PATCH v4 " Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 2/4] build: use dependency() instead of find_library() Luca Boccassi
  2019-01-11 18:22   ` [PATCH v4 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
@ 2019-01-11 18:22   ` Luca Boccassi
  2 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-11 18:22 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: only add dependency to librte_eal and let it propagate from there
v4: add acked-by

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@ version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
-- 
2.20.1

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

* Re: [PATCH v3 2/4] build: use dependency() instead of find_library()
  2019-01-11 18:16       ` Luca Boccassi
@ 2019-01-11 21:49         ` Bruce Richardson
  0 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-11 21:49 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Fri, Jan 11, 2019 at 06:16:23PM +0000, Luca Boccassi wrote:
> On Fri, 2019-01-11 at 17:21 +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 04:26:06PM +0000, Luca Boccassi wrote:
> > > Whenever possible (if the library ships a pkg-config file) use
> > > meson's
> > > dependency() function to look for it, as it will automatically add
> > > it
> > > to the Requires.private list if needed, to allow for static builds
> > > to
> > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > dependencies are not parsed, and users doing static builds have to
> > > resolve them manually by themselves.
> > > When using this API avoid additional checks that are superfluos and
> > 
> > Spelling: superfluous
> 
> I _always_ get that one wrong :-)
> 
I often spell it as "unnecessary" to make life easier :-)

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

* [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
                   ` (3 preceding siblings ...)
  2019-01-11 18:22 ` [PATCH v4 " Luca Boccassi
@ 2019-01-22 13:10 ` Luca Boccassi
  2019-01-22 13:10   ` [PATCH v5 2/4] build: use dependency() instead of find_library() Luca Boccassi
                     ` (3 more replies)
  2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
                   ` (2 subsequent siblings)
  7 siblings, 4 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-22 13:10 UTC (permalink / raw)
  To: dev; +Cc: Luca Boccassi

Meson 0.47.1 fixed a bug that is difficult to work around, which causes
the linker flag of dependencies to be repeated dozens of times, which
causes issues especially when using the built-in dependency() API.
Bump the minimum version and remove obsolete version checks.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug
v3: split away first independent patch from series
v4: add acked-by

 drivers/meson.build      |  5 +----
 kernel/linux/meson.build |  6 +-----
 meson.build              | 35 +++++++++++++++--------------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..e37d4fe2b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -148,8 +148,5 @@ foreach class:driver_classes
 		endif # build
 	endforeach
 
-	if meson.version().version_compare('>=0.47')
-		# prior to 0.47, set_variable can't take array params
-		set_variable(class + '_drivers', class_drivers)
-	endif
+	set_variable(class + '_drivers', class_drivers)
 endforeach
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index 5b7ec06e1..d751d939f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -27,11 +27,7 @@ else
 	make_returncode = run_command('make', '-sC', kernel_dir,
 			'kernelversion').returncode()
 	if make_returncode != 0
-		if meson.version().version_compare('>=0.44')
-			warning(WARN_NO_HEADERS)
-		else
-			message('WARNING: ' + WARN_NO_HEADERS)
-		endif
+		warning(WARN_NO_HEADERS)
 	else # returncode == 0
 
 # DO ACTUAL MODULE BUILDING
diff --git a/meson.build b/meson.build
index 68429f850..bef38ac37 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.02.0-rc3',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
@@ -105,23 +105,18 @@ foreach lib:enabled_libs
 endforeach
 message(output_message + '\n')
 
-
-# prior to 0.47 set_variable didn't work with arrays, so we can't
-# track driver lists easily
-if meson.version().version_compare('>=0.47')
-	output_message = '\n===============\nDrivers Enabled\n===============\n'
-	foreach class:driver_classes
-		class_drivers = get_variable(class + '_drivers')
-		output_message += '\n' + class + ':\n\t'
-		output_count = 0
-		foreach drv:class_drivers
-			output_message += drv + ', '
-			output_count += 1
-			if output_count == 8
-				output_message += '\n\t'
-				output_count = 0
-			endif
-		endforeach
+output_message = '\n===============\nDrivers Enabled\n===============\n'
+foreach class:driver_classes
+	class_drivers = get_variable(class + '_drivers')
+	output_message += '\n' + class + ':\n\t'
+	output_count = 0
+	foreach drv:class_drivers
+		output_message += drv + ', '
+		output_count += 1
+		if output_count == 8
+			output_message += '\n\t'
+			output_count = 0
+		endif
 	endforeach
-	message(output_message + '\n')
-endif
+endforeach
+message(output_message + '\n')
-- 
2.20.1

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

* [PATCH v5 2/4] build: use dependency() instead of find_library()
  2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
@ 2019-01-22 13:10   ` Luca Boccassi
  2019-01-22 13:46     ` Bruce Richardson
  2019-01-22 14:25     ` Bruce Richardson
  2019-01-22 13:10   ` [PATCH v5 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-22 13:10 UTC (permalink / raw)
  To: dev; +Cc: Luca Boccassi

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluous and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required
v4: update comment in drivers/meson.build to clarify role of
    pkgconfig_extra_libs
v5: remove -lz from drivers/compress/zlib

 drivers/compress/zlib/meson.build  | 1 -
 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 9 +++++----
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 drivers/net/pcap/meson.build       | 5 ++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 11 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/compress/zlib/meson.build b/drivers/compress/zlib/meson.build
index 7748de2df..b036703c7 100644
--- a/drivers/compress/zlib/meson.build
+++ b/drivers/compress/zlib/meson.build
@@ -9,6 +9,5 @@ endif
 deps += 'bus_vdev'
 sources = files('zlib_pmd.c', 'zlib_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lz'
 
 allow_experimental_apis = true
diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index 77a6596d7..d56a32366 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -9,4 +9,3 @@ allow_experimental_apis = true
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index e37d4fe2b..69d0556d3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,10 +46,11 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
-		# probably also need to specify the "-l" flags in
-		# pkgconfig_extra_libs variable too, so that it can be reflected
-		# in the pkgconfig output for static builds
+		# using dependency() (preferred) or find_library().
+		# For the find_library() case (but not with dependency()) we also
+		# need to specify the "-l" flags in pkgconfig_extra_libs variable
+		# too, so that it can be reflected in the pkgconfig output for
+		# static builds.
 		ext_deps = []
 		pkgconfig_extra_libs = []
 
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 4bccd68e0..b4f9672e7 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 4540c455b..0cf2f0873 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..89c9d7a74 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
 	build = false
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
-- 
2.20.1

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

* [PATCH v5 3/4] build: reorder libraries and build eal before cmdline
  2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-01-22 13:10   ` [PATCH v5 2/4] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-22 13:10   ` Luca Boccassi
  2019-01-22 13:10   ` [PATCH v5 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
  2019-01-22 13:42   ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Bruce Richardson
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-22 13:10 UTC (permalink / raw)
  To: dev; +Cc: Luca Boccassi, Bruce Richardson

Most libraries and PMDs depend on eal, and eal depends only on kvargs,
so reorder the list in Meson to reflect this and take advantage of this
dependency chain.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: added this patch to let the next just update librte_eal instead of
    also having to update rte_cmdline
v4: add acked-by

 lib/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index e8b40f546..074a8b8b4 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,9 +9,10 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [ 'compat', # just a header, used for versioning
-	'cmdline', # ethdev depends on cmdline for parsing functions
 	'kvargs', # eal depends on kvargs
-	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
+	'eal', # everything depends on eal
+	'cmdline', # ethdev depends on cmdline for parsing functions
+	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
 	'metrics', # bitrate/latency stats depends on this
 	'hash',    # efd depends on this
 	'timer',   # eventdev depends on this
-- 
2.20.1

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

* [PATCH v5 4/4] build: use dependency() for libbsd instead of manual append to ldflags
  2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-01-22 13:10   ` [PATCH v5 2/4] build: use dependency() instead of find_library() Luca Boccassi
  2019-01-22 13:10   ` [PATCH v5 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
@ 2019-01-22 13:10   ` Luca Boccassi
  2019-01-22 13:42   ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Bruce Richardson
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-01-22 13:10 UTC (permalink / raw)
  To: dev; +Cc: Luca Boccassi, Bruce Richardson

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: only add dependency to librte_eal and let it propagate from there
v4: add acked-by

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@ version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
-- 
2.20.1

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

* Re: [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1
  2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
                     ` (2 preceding siblings ...)
  2019-01-22 13:10   ` [PATCH v5 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
@ 2019-01-22 13:42   ` Bruce Richardson
  3 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-22 13:42 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Tue, Jan 22, 2019 at 01:10:51PM +0000, Luca Boccassi wrote:
> Meson 0.47.1 fixed a bug that is difficult to work around, which causes
> the linker flag of dependencies to be repeated dozens of times, which
> causes issues especially when using the built-in dependency() API.
> Bump the minimum version and remove obsolete version checks.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: bump meson minimum version to 0.47.1 to avoid meson bug
> v3: split away first independent patch from series
> v4: add acked-by
> 
>  drivers/meson.build      |  5 +----
>  kernel/linux/meson.build |  6 +-----
>  meson.build              | 35 +++++++++++++++--------------------
>  3 files changed, 17 insertions(+), 29 deletions(-)
> 
LGTM
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [PATCH v5 2/4] build: use dependency() instead of find_library()
  2019-01-22 13:10   ` [PATCH v5 2/4] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-01-22 13:46     ` Bruce Richardson
  2019-01-22 14:09       ` Luca Boccassi
  2019-01-22 14:25     ` Bruce Richardson
  1 sibling, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-01-22 13:46 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Tue, Jan 22, 2019 at 01:10:52PM +0000, Luca Boccassi wrote:
> Whenever possible (if the library ships a pkg-config file) use meson's
> dependency() function to look for it, as it will automatically add it
> to the Requires.private list if needed, to allow for static builds to
> succeed for reverse dependencies of DPDK. Otherwise the recursive
> dependencies are not parsed, and users doing static builds have to
> resolve them manually by themselves.
> When using this API avoid additional checks that are superfluous and
> take extra time, and avoid adding the linker flag manually which causes
> it to be duplicated.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: split libbsd change in a separate commit, remove CC to stable
>     as a meson bump will be required
> v4: update comment in drivers/meson.build to clarify role of
>     pkgconfig_extra_libs
> v5: remove -lz from drivers/compress/zlib

How is this removal possible? Does drivers/compress/zlib no longer depend
on libz, or is there a dependency added somewhere else in this patch that
I'm missing? Similar question with the -lcrypto removal?

/Bruce

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

* Re: [PATCH v5 2/4] build: use dependency() instead of find_library()
  2019-01-22 13:46     ` Bruce Richardson
@ 2019-01-22 14:09       ` Luca Boccassi
  2019-01-22 14:24         ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-01-22 14:09 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Tue, 2019-01-22 at 13:46 +0000, Bruce Richardson wrote:
> On Tue, Jan 22, 2019 at 01:10:52PM +0000, Luca Boccassi wrote:
> > Whenever possible (if the library ships a pkg-config file) use
> > meson's
> > dependency() function to look for it, as it will automatically add
> > it
> > to the Requires.private list if needed, to allow for static builds
> > to
> > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > dependencies are not parsed, and users doing static builds have to
> > resolve them manually by themselves.
> > When using this API avoid additional checks that are superfluous
> > and
> > take extra time, and avoid adding the linker flag manually which
> > causes
> > it to be duplicated.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > v2: split libbsd change in a separate commit, remove CC to stable
> >     as a meson bump will be required
> > v4: update comment in drivers/meson.build to clarify role of
> >     pkgconfig_extra_libs
> > v5: remove -lz from drivers/compress/zlib
> 
> How is this removal possible? Does drivers/compress/zlib no longer
> depend
> on libz, or is there a dependency added somewhere else in this patch
> that
> I'm missing? Similar question with the -lcrypto removal?
> 
> /Bruce

Note that the removal is from the pkgconfig_extra_libs list - same for
lcrypto.
They use dependency() already, and the dep is added to the ext_deps, so
the dependency comes in that way (and the right flags are picked via
pkg-config).

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v5 2/4] build: use dependency() instead of find_library()
  2019-01-22 14:09       ` Luca Boccassi
@ 2019-01-22 14:24         ` Bruce Richardson
  0 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-22 14:24 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Tue, Jan 22, 2019 at 02:09:41PM +0000, Luca Boccassi wrote:
> On Tue, 2019-01-22 at 13:46 +0000, Bruce Richardson wrote:
> > On Tue, Jan 22, 2019 at 01:10:52PM +0000, Luca Boccassi wrote:
> > > Whenever possible (if the library ships a pkg-config file) use
> > > meson's
> > > dependency() function to look for it, as it will automatically add
> > > it
> > > to the Requires.private list if needed, to allow for static builds
> > > to
> > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > dependencies are not parsed, and users doing static builds have to
> > > resolve them manually by themselves.
> > > When using this API avoid additional checks that are superfluous
> > > and
> > > take extra time, and avoid adding the linker flag manually which
> > > causes
> > > it to be duplicated.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > ---
> > > v2: split libbsd change in a separate commit, remove CC to stable
> > >     as a meson bump will be required
> > > v4: update comment in drivers/meson.build to clarify role of
> > >     pkgconfig_extra_libs
> > > v5: remove -lz from drivers/compress/zlib
> > 
> > How is this removal possible? Does drivers/compress/zlib no longer
> > depend
> > on libz, or is there a dependency added somewhere else in this patch
> > that
> > I'm missing? Similar question with the -lcrypto removal?
> > 
> > /Bruce
> 
> Note that the removal is from the pkgconfig_extra_libs list - same for
> lcrypto.
> They use dependency() already, and the dep is added to the ext_deps, so
> the dependency comes in that way (and the right flags are picked via
> pkg-config).
> 

Ok, that is clear now. I didn't realise that they already used dependency
for it.

/Bruce

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

* Re: [PATCH v5 2/4] build: use dependency() instead of find_library()
  2019-01-22 13:10   ` [PATCH v5 2/4] build: use dependency() instead of find_library() Luca Boccassi
  2019-01-22 13:46     ` Bruce Richardson
@ 2019-01-22 14:25     ` Bruce Richardson
  1 sibling, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-01-22 14:25 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Tue, Jan 22, 2019 at 01:10:52PM +0000, Luca Boccassi wrote:
> Whenever possible (if the library ships a pkg-config file) use meson's
> dependency() function to look for it, as it will automatically add it
> to the Requires.private list if needed, to allow for static builds to
> succeed for reverse dependencies of DPDK. Otherwise the recursive
> dependencies are not parsed, and users doing static builds have to
> resolve them manually by themselves.
> When using this API avoid additional checks that are superfluous and
> take extra time, and avoid adding the linker flag manually which causes
> it to be duplicated.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: split libbsd change in a separate commit, remove CC to stable
>     as a meson bump will be required
> v4: update comment in drivers/meson.build to clarify role of
>     pkgconfig_extra_libs
> v5: remove -lz from drivers/compress/zlib
> 
This is a good idea. Using dependency objects is much better than trying to
track flags manually.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* [PATCH v6 1/5] build: bump minimum Meson version to 0.47.1
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
                   ` (4 preceding siblings ...)
  2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
@ 2019-02-06 17:08 ` Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 2/5] build: use dependency() instead of find_library() Luca Boccassi
                     ` (3 more replies)
  2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
  7 siblings, 4 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-06 17:08 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Meson 0.47.1 fixed a bug that is difficult to work around, which causes
the linker flag of dependencies to be repeated dozens of times, which
causes issues especially when using the built-in dependency() API.
Bump the minimum version and remove obsolete version checks.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug
v3: split away first independent patch from series
v4: add acked-by

 drivers/meson.build      |  5 +----
 kernel/linux/meson.build |  6 +-----
 meson.build              | 35 +++++++++++++++--------------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..e37d4fe2b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -148,8 +148,5 @@ foreach class:driver_classes
 		endif # build
 	endforeach
 
-	if meson.version().version_compare('>=0.47')
-		# prior to 0.47, set_variable can't take array params
-		set_variable(class + '_drivers', class_drivers)
-	endif
+	set_variable(class + '_drivers', class_drivers)
 endforeach
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index 5b7ec06e1..d751d939f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -27,11 +27,7 @@ else
 	make_returncode = run_command('make', '-sC', kernel_dir,
 			'kernelversion').returncode()
 	if make_returncode != 0
-		if meson.version().version_compare('>=0.44')
-			warning(WARN_NO_HEADERS)
-		else
-			message('WARNING: ' + WARN_NO_HEADERS)
-		endif
+		warning(WARN_NO_HEADERS)
 	else # returncode == 0
 
 # DO ACTUAL MODULE BUILDING
diff --git a/meson.build b/meson.build
index 7f5e8674b..e9793b127 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.05.0-rc0',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
@@ -105,23 +105,18 @@ foreach lib:enabled_libs
 endforeach
 message(output_message + '\n')
 
-
-# prior to 0.47 set_variable didn't work with arrays, so we can't
-# track driver lists easily
-if meson.version().version_compare('>=0.47')
-	output_message = '\n===============\nDrivers Enabled\n===============\n'
-	foreach class:driver_classes
-		class_drivers = get_variable(class + '_drivers')
-		output_message += '\n' + class + ':\n\t'
-		output_count = 0
-		foreach drv:class_drivers
-			output_message += drv + ', '
-			output_count += 1
-			if output_count == 8
-				output_message += '\n\t'
-				output_count = 0
-			endif
-		endforeach
+output_message = '\n===============\nDrivers Enabled\n===============\n'
+foreach class:driver_classes
+	class_drivers = get_variable(class + '_drivers')
+	output_message += '\n' + class + ':\n\t'
+	output_count = 0
+	foreach drv:class_drivers
+		output_message += drv + ', '
+		output_count += 1
+		if output_count == 8
+			output_message += '\n\t'
+			output_count = 0
+		endif
 	endforeach
-	message(output_message + '\n')
-endif
+endforeach
+message(output_message + '\n')
-- 
2.20.1

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

* [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
@ 2019-02-06 17:08   ` Luca Boccassi
  2019-02-12 11:15     ` Thomas Monjalon
  2019-02-06 17:08   ` [PATCH v6 3/5] build: reorder libraries and build eal before cmdline Luca Boccassi
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-02-06 17:08 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluous and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required
v4: update comment in drivers/meson.build to clarify role of
    pkgconfig_extra_libs
v5: remove -lz from drivers/compress/zlib

 drivers/compress/zlib/meson.build  | 1 -
 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 9 +++++----
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 drivers/net/pcap/meson.build       | 5 ++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 11 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/compress/zlib/meson.build b/drivers/compress/zlib/meson.build
index 7748de2df..b036703c7 100644
--- a/drivers/compress/zlib/meson.build
+++ b/drivers/compress/zlib/meson.build
@@ -9,6 +9,5 @@ endif
 deps += 'bus_vdev'
 sources = files('zlib_pmd.c', 'zlib_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lz'
 
 allow_experimental_apis = true
diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index 77a6596d7..d56a32366 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -9,4 +9,3 @@ allow_experimental_apis = true
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index e37d4fe2b..69d0556d3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,10 +46,11 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
-		# probably also need to specify the "-l" flags in
-		# pkgconfig_extra_libs variable too, so that it can be reflected
-		# in the pkgconfig output for static builds
+		# using dependency() (preferred) or find_library().
+		# For the find_library() case (but not with dependency()) we also
+		# need to specify the "-l" flags in pkgconfig_extra_libs variable
+		# too, so that it can be reflected in the pkgconfig output for
+		# static builds.
 		ext_deps = []
 		pkgconfig_extra_libs = []
 
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 4bccd68e0..b4f9672e7 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 4540c455b..0cf2f0873 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..89c9d7a74 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
 	build = false
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
-- 
2.20.1

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

* [PATCH v6 3/5] build: reorder libraries and build eal before cmdline
  2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 2/5] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-02-06 17:08   ` Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 4/5] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 5/5] build: use integers for numerical options Luca Boccassi
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-06 17:08 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Most libraries and PMDs depend on eal, and eal depends only on kvargs,
so reorder the list in Meson to reflect this and take advantage of this
dependency chain.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: added this patch to let the next just update librte_eal instead of
    also having to update rte_cmdline
v4: add acked-by

 lib/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index e8b40f546..074a8b8b4 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,9 +9,10 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [ 'compat', # just a header, used for versioning
-	'cmdline', # ethdev depends on cmdline for parsing functions
 	'kvargs', # eal depends on kvargs
-	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
+	'eal', # everything depends on eal
+	'cmdline', # ethdev depends on cmdline for parsing functions
+	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
 	'metrics', # bitrate/latency stats depends on this
 	'hash',    # efd depends on this
 	'timer',   # eventdev depends on this
-- 
2.20.1

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

* [PATCH v6 4/5] build: use dependency() for libbsd instead of manual append to ldflags
  2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 2/5] build: use dependency() instead of find_library() Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 3/5] build: reorder libraries and build eal before cmdline Luca Boccassi
@ 2019-02-06 17:08   ` Luca Boccassi
  2019-02-06 17:08   ` [PATCH v6 5/5] build: use integers for numerical options Luca Boccassi
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-06 17:08 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: only add dependency to librte_eal and let it propagate from there
v4: add acked-by

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@ version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
-- 
2.20.1

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

* [PATCH v6 5/5] build: use integers for numerical options
  2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
                     ` (2 preceding siblings ...)
  2019-02-06 17:08   ` [PATCH v6 4/5] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
@ 2019-02-06 17:08   ` Luca Boccassi
  2019-02-08 14:44     ` Bruce Richardson
  3 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-02-06 17:08 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Now that the minimum Meson version has been bumped past 0.45 we can use
integer as an option type directly.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v6: added following Bruce's suggestion

 meson_options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 574054597..4e178178f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,9 +18,9 @@ option('lib_musdk_dir', type: 'string', value: '',
 	description: 'path to the MUSDK library installation directory')
 option('machine', type: 'string', value: 'native',
 	description: 'set the target machine type')
-option('max_lcores', type: 'string', value: '128',
+option('max_lcores', type: 'integer', value: 128,
 	description: 'maximum number of cores/threads supported by EAL')
-option('max_numa_nodes', type: 'string', value: '4',
+option('max_numa_nodes', type: 'integer', value: 4,
 	description: 'maximum number of NUMA nodes supported by EAL')
 option('per_library_versions', type: 'boolean', value: true,
 	description: 'true: each lib gets its own version number, false: DPDK version used for each lib')
-- 
2.20.1

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

* Re: [PATCH v6 5/5] build: use integers for numerical options
  2019-02-06 17:08   ` [PATCH v6 5/5] build: use integers for numerical options Luca Boccassi
@ 2019-02-08 14:44     ` Bruce Richardson
  0 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-02-08 14:44 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Wed, Feb 06, 2019 at 05:08:48PM +0000, Luca Boccassi wrote:
> Now that the minimum Meson version has been bumped past 0.45 we can use
> integer as an option type directly.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v6: added following Bruce's suggestion
> 
Since I suggested it, I naturally think this is a brilliant idea! :-)

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-06 17:08   ` [PATCH v6 2/5] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-02-12 11:15     ` Thomas Monjalon
  2019-02-12 11:31       ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-12 11:15 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, bruce.richardson

06/02/2019 18:08, Luca Boccassi:
> Whenever possible (if the library ships a pkg-config file) use meson's
> dependency() function to look for it, as it will automatically add it
> to the Requires.private list if needed, to allow for static builds to
> succeed for reverse dependencies of DPDK. Otherwise the recursive
> dependencies are not parsed, and users doing static builds have to
> resolve them manually by themselves.
> When using this API avoid additional checks that are superfluous and
> take extra time, and avoid adding the linker flag manually which causes
> it to be duplicated.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

This patch breaks compilation on my machine with a lot of strange errors:

from drivers/net/pcap/rte_eth_pcap.c

/usr/include/stdint.h:109: error: "__INT64_C" redefined
/usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
/usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
etc

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 11:15     ` Thomas Monjalon
@ 2019-02-12 11:31       ` Bruce Richardson
  2019-02-12 11:36         ` Thomas Monjalon
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-02-12 11:31 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Luca Boccassi, dev

On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon wrote:
> 06/02/2019 18:08, Luca Boccassi:
> > Whenever possible (if the library ships a pkg-config file) use meson's
> > dependency() function to look for it, as it will automatically add it
> > to the Requires.private list if needed, to allow for static builds to
> > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > dependencies are not parsed, and users doing static builds have to
> > resolve them manually by themselves.
> > When using this API avoid additional checks that are superfluous and
> > take extra time, and avoid adding the linker flag manually which causes
> > it to be duplicated.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> This patch breaks compilation on my machine with a lot of strange errors:
> 
> from drivers/net/pcap/rte_eth_pcap.c
> 
> /usr/include/stdint.h:109: error: "__INT64_C" redefined
> /usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
> /usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
> etc
>
Is this on Arch linux again? I just reverified these first two patches and
they work fine for me on Fedora (I assume Luca probably tested them already on
Debian) 

Anything unusual about your setup?

/Bruce

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 11:31       ` Bruce Richardson
@ 2019-02-12 11:36         ` Thomas Monjalon
  2019-02-12 11:43           ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-12 11:36 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Luca Boccassi, dev

12/02/2019 12:31, Bruce Richardson:
> On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon wrote:
> > 06/02/2019 18:08, Luca Boccassi:
> > > Whenever possible (if the library ships a pkg-config file) use meson's
> > > dependency() function to look for it, as it will automatically add it
> > > to the Requires.private list if needed, to allow for static builds to
> > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > dependencies are not parsed, and users doing static builds have to
> > > resolve them manually by themselves.
> > > When using this API avoid additional checks that are superfluous and
> > > take extra time, and avoid adding the linker flag manually which causes
> > > it to be duplicated.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > 
> > This patch breaks compilation on my machine with a lot of strange errors:
> > 
> > from drivers/net/pcap/rte_eth_pcap.c
> > 
> > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
> > /usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
> > etc
> >
> Is this on Arch linux again? I just reverified these first two patches and
> they work fine for me on Fedora (I assume Luca probably tested them already on
> Debian) 
> 
> Anything unusual about your setup?

Nothing unusual. Just using the best environment ever ;)
I will try to debug it.

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 11:36         ` Thomas Monjalon
@ 2019-02-12 11:43           ` Bruce Richardson
  2019-02-12 14:47             ` Thomas Monjalon
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-02-12 11:43 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Luca Boccassi, dev

On Tue, Feb 12, 2019 at 12:36:17PM +0100, Thomas Monjalon wrote:
> 12/02/2019 12:31, Bruce Richardson:
> > On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon wrote:
> > > 06/02/2019 18:08, Luca Boccassi:
> > > > Whenever possible (if the library ships a pkg-config file) use meson's
> > > > dependency() function to look for it, as it will automatically add it
> > > > to the Requires.private list if needed, to allow for static builds to
> > > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > > dependencies are not parsed, and users doing static builds have to
> > > > resolve them manually by themselves.
> > > > When using this API avoid additional checks that are superfluous and
> > > > take extra time, and avoid adding the linker flag manually which causes
> > > > it to be duplicated.
> > > > 
> > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > > 
> > > This patch breaks compilation on my machine with a lot of strange errors:
> > > 
> > > from drivers/net/pcap/rte_eth_pcap.c
> > > 
> > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
> > > /usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
> > > etc
> > >
> > Is this on Arch linux again? I just reverified these first two patches and
> > they work fine for me on Fedora (I assume Luca probably tested them already on
> > Debian) 
> > 
> > Anything unusual about your setup?
> 
> Nothing unusual. Just using the best environment ever ;)
> I will try to debug it.
> 
It may be something pcap-specific, since pcap has to have it's own special
query mechanims outside the normal pkg-config one. If you remove the
pcap-driver changes, does the rest of the patch work for you?

/Bruce

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 11:43           ` Bruce Richardson
@ 2019-02-12 14:47             ` Thomas Monjalon
  2019-02-12 15:03               ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-12 14:47 UTC (permalink / raw)
  To: Bruce Richardson, Luca Boccassi; +Cc: dev

12/02/2019 12:43, Bruce Richardson:
> On Tue, Feb 12, 2019 at 12:36:17PM +0100, Thomas Monjalon wrote:
> > 12/02/2019 12:31, Bruce Richardson:
> > > On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon wrote:
> > > > 06/02/2019 18:08, Luca Boccassi:
> > > > > Whenever possible (if the library ships a pkg-config file) use meson's
> > > > > dependency() function to look for it, as it will automatically add it
> > > > > to the Requires.private list if needed, to allow for static builds to
> > > > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > > > dependencies are not parsed, and users doing static builds have to
> > > > > resolve them manually by themselves.
> > > > > When using this API avoid additional checks that are superfluous and
> > > > > take extra time, and avoid adding the linker flag manually which causes
> > > > > it to be duplicated.
> > > > > 
> > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > 
> > > > This patch breaks compilation on my machine with a lot of strange errors:
> > > > 
> > > > from drivers/net/pcap/rte_eth_pcap.c
> > > > 
> > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
> > > > /usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
> > > > etc
> > > >
> > > Is this on Arch linux again? I just reverified these first two patches and
> > > they work fine for me on Fedora (I assume Luca probably tested them already on
> > > Debian) 
> > > 
> > > Anything unusual about your setup?
> > 
> > Nothing unusual. Just using the best environment ever ;)
> > I will try to debug it.
> > 
> It may be something pcap-specific, since pcap has to have it's own special
> query mechanims outside the normal pkg-config one. If you remove the
> pcap-driver changes, does the rest of the patch work for you?

Yes, the issue happens only with pcap on Arm.
Reverting the pcap related changes, it builds fine.

More infos about my setup:
	meson-0.49.1
	aarch64-linux-gnu-gcc-8.2.0
	libpcap-1.9.0 (32 and 64-bit) for x86

I think there is a mix between libcap for x86 and Arm compilation.
Probably a meson bug?

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 14:47             ` Thomas Monjalon
@ 2019-02-12 15:03               ` Bruce Richardson
  2019-02-12 16:21                 ` Thomas Monjalon
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-02-12 15:03 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Luca Boccassi, dev

On Tue, Feb 12, 2019 at 03:47:56PM +0100, Thomas Monjalon wrote:
> 12/02/2019 12:43, Bruce Richardson:
> > On Tue, Feb 12, 2019 at 12:36:17PM +0100, Thomas Monjalon wrote:
> > > 12/02/2019 12:31, Bruce Richardson:
> > > > On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon wrote:
> > > > > 06/02/2019 18:08, Luca Boccassi:
> > > > > > Whenever possible (if the library ships a pkg-config file) use meson's
> > > > > > dependency() function to look for it, as it will automatically add it
> > > > > > to the Requires.private list if needed, to allow for static builds to
> > > > > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > > > > dependencies are not parsed, and users doing static builds have to
> > > > > > resolve them manually by themselves.
> > > > > > When using this API avoid additional checks that are superfluous and
> > > > > > take extra time, and avoid adding the linker flag manually which causes
> > > > > > it to be duplicated.
> > > > > > 
> > > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > > 
> > > > > This patch breaks compilation on my machine with a lot of strange errors:
> > > > > 
> > > > > from drivers/net/pcap/rte_eth_pcap.c
> > > > > 
> > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
> > > > > /usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
> > > > > etc
> > > > >
> > > > Is this on Arch linux again? I just reverified these first two patches and
> > > > they work fine for me on Fedora (I assume Luca probably tested them already on
> > > > Debian) 
> > > > 
> > > > Anything unusual about your setup?
> > > 
> > > Nothing unusual. Just using the best environment ever ;)
> > > I will try to debug it.
> > > 
> > It may be something pcap-specific, since pcap has to have it's own special
> > query mechanims outside the normal pkg-config one. If you remove the
> > pcap-driver changes, does the rest of the patch work for you?
> 
> Yes, the issue happens only with pcap on Arm.
> Reverting the pcap related changes, it builds fine.
> 
> More infos about my setup:
> 	meson-0.49.1
> 	aarch64-linux-gnu-gcc-8.2.0
> 	libpcap-1.9.0 (32 and 64-bit) for x86
> 
> I think there is a mix between libcap for x86 and Arm compilation.
> Probably a meson bug?
> 
Could well be a meson issue. It may be using the local pcap-config rather
than the cross-compilation version [assuming cross-compilation here, though
I don't see the issue with my setup].

Thomas, can you apply this set with the pcap driver change dropped,
or is it better if Luca does a new version of this set?

/Bruce

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 15:03               ` Bruce Richardson
@ 2019-02-12 16:21                 ` Thomas Monjalon
  2019-02-13 10:49                   ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-12 16:21 UTC (permalink / raw)
  To: Bruce Richardson, Luca Boccassi; +Cc: dev

12/02/2019 16:03, Bruce Richardson:
> On Tue, Feb 12, 2019 at 03:47:56PM +0100, Thomas Monjalon wrote:
> > 12/02/2019 12:43, Bruce Richardson:
> > > On Tue, Feb 12, 2019 at 12:36:17PM +0100, Thomas Monjalon wrote:
> > > > 12/02/2019 12:31, Bruce Richardson:
> > > > > On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon wrote:
> > > > > > 06/02/2019 18:08, Luca Boccassi:
> > > > > > > Whenever possible (if the library ships a pkg-config file) use meson's
> > > > > > > dependency() function to look for it, as it will automatically add it
> > > > > > > to the Requires.private list if needed, to allow for static builds to
> > > > > > > succeed for reverse dependencies of DPDK. Otherwise the recursive
> > > > > > > dependencies are not parsed, and users doing static builds have to
> > > > > > > resolve them manually by themselves.
> > > > > > > When using this API avoid additional checks that are superfluous and
> > > > > > > take extra time, and avoid adding the linker flag manually which causes
> > > > > > > it to be duplicated.
> > > > > > > 
> > > > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > > > 
> > > > > > This patch breaks compilation on my machine with a lot of strange errors:
> > > > > > 
> > > > > > from drivers/net/pcap/rte_eth_pcap.c
> > > > > > 
> > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards 'const' qualifier from pointer target type
> > > > > > /usr/include/pthread.h:682:6: error: 'regparm' attribute directive ignored
> > > > > > etc
> > > > > >
> > > > > Is this on Arch linux again? I just reverified these first two patches and
> > > > > they work fine for me on Fedora (I assume Luca probably tested them already on
> > > > > Debian) 
> > > > > 
> > > > > Anything unusual about your setup?
> > > > 
> > > > Nothing unusual. Just using the best environment ever ;)
> > > > I will try to debug it.
> > > > 
> > > It may be something pcap-specific, since pcap has to have it's own special
> > > query mechanims outside the normal pkg-config one. If you remove the
> > > pcap-driver changes, does the rest of the patch work for you?
> > 
> > Yes, the issue happens only with pcap on Arm.
> > Reverting the pcap related changes, it builds fine.
> > 
> > More infos about my setup:
> > 	meson-0.49.1
> > 	aarch64-linux-gnu-gcc-8.2.0
> > 	libpcap-1.9.0 (32 and 64-bit) for x86
> > 
> > I think there is a mix between libcap for x86 and Arm compilation.
> > Probably a meson bug?
> > 
> Could well be a meson issue. It may be using the local pcap-config rather
> than the cross-compilation version [assuming cross-compilation here, though
> I don't see the issue with my setup].
> 
> Thomas, can you apply this set with the pcap driver change dropped,
> or is it better if Luca does a new version of this set?

I think we need a comment about the pcap miss.
Probably better to do a new version.

Luca, please could you test cross-compilation?

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-12 16:21                 ` Thomas Monjalon
@ 2019-02-13 10:49                   ` Luca Boccassi
  2019-02-13 11:10                     ` Thomas Monjalon
  2019-02-13 11:48                     ` Luca Boccassi
  0 siblings, 2 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 10:49 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson; +Cc: dev

On Tue, 2019-02-12 at 17:21 +0100, Thomas Monjalon wrote:
> 12/02/2019 16:03, Bruce Richardson:
> > On Tue, Feb 12, 2019 at 03:47:56PM +0100, Thomas Monjalon wrote:
> > > 12/02/2019 12:43, Bruce Richardson:
> > > > On Tue, Feb 12, 2019 at 12:36:17PM +0100, Thomas Monjalon
> > > > wrote:
> > > > > 12/02/2019 12:31, Bruce Richardson:
> > > > > > On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon
> > > > > > wrote:
> > > > > > > 06/02/2019 18:08, Luca Boccassi:
> > > > > > > > Whenever possible (if the library ships a pkg-config
> > > > > > > > file) use meson's
> > > > > > > > dependency() function to look for it, as it will
> > > > > > > > automatically add it
> > > > > > > > to the Requires.private list if needed, to allow for
> > > > > > > > static builds to
> > > > > > > > succeed for reverse dependencies of DPDK. Otherwise the
> > > > > > > > recursive
> > > > > > > > dependencies are not parsed, and users doing static
> > > > > > > > builds have to
> > > > > > > > resolve them manually by themselves.
> > > > > > > > When using this API avoid additional checks that are
> > > > > > > > superfluous and
> > > > > > > > take extra time, and avoid adding the linker flag
> > > > > > > > manually which causes
> > > > > > > > it to be duplicated.
> > > > > > > > 
> > > > > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > > > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > > > > 
> > > > > > > This patch breaks compilation on my machine with a lot of
> > > > > > > strange errors:
> > > > > > > 
> > > > > > > from drivers/net/pcap/rte_eth_pcap.c
> > > > > > > 
> > > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast
> > > > > > > discards 'const' qualifier from pointer target type
> > > > > > > /usr/include/pthread.h:682:6: error: 'regparm' attribute
> > > > > > > directive ignored
> > > > > > > etc
> > > > > > > 
> > > > > > 
> > > > > > Is this on Arch linux again? I just reverified these first
> > > > > > two patches and
> > > > > > they work fine for me on Fedora (I assume Luca probably
> > > > > > tested them already on
> > > > > > Debian) 
> > > > > > 
> > > > > > Anything unusual about your setup?
> > > > > 
> > > > > Nothing unusual. Just using the best environment ever ;)
> > > > > I will try to debug it.
> > > > > 
> > > > 
> > > > It may be something pcap-specific, since pcap has to have it's
> > > > own special
> > > > query mechanims outside the normal pkg-config one. If you
> > > > remove the
> > > > pcap-driver changes, does the rest of the patch work for you?
> > > 
> > > Yes, the issue happens only with pcap on Arm.
> > > Reverting the pcap related changes, it builds fine.
> > > 
> > > More infos about my setup:
> > > 	meson-0.49.1
> > > 	aarch64-linux-gnu-gcc-8.2.0
> > > 	libpcap-1.9.0 (32 and 64-bit) for x86
> > > 
> > > I think there is a mix between libcap for x86 and Arm
> > > compilation.
> > > Probably a meson bug?
> > > 
> > 
> > Could well be a meson issue. It may be using the local pcap-config
> > rather
> > than the cross-compilation version [assuming cross-compilation
> > here, though
> > I don't see the issue with my setup].
> > 
> > Thomas, can you apply this set with the pcap driver change dropped,
> > or is it better if Luca does a new version of this set?
> 
> I think we need a comment about the pcap miss.
> Probably better to do a new version.
> 
> Luca, please could you test cross-compilation?

Hi,

I would, except downloading the toolchain from Linaro fails with 403
forbidden...

https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz

I'll try with Debian's cross compiler

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-13 10:49                   ` Luca Boccassi
@ 2019-02-13 11:10                     ` Thomas Monjalon
  2019-02-13 13:45                       ` Luca Boccassi
  2019-02-13 11:48                     ` Luca Boccassi
  1 sibling, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-13 11:10 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: Bruce Richardson, dev

13/02/2019 11:49, Luca Boccassi:
> On Tue, 2019-02-12 at 17:21 +0100, Thomas Monjalon wrote:
> > Luca, please could you test cross-compilation?
> 
> Hi,
> 
> I would, except downloading the toolchain from Linaro fails with 403
> forbidden...
> 
> https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> 
> I'll try with Debian's cross compiler

You can also test this one: https://toolchains.bootlin.com/

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-13 10:49                   ` Luca Boccassi
  2019-02-13 11:10                     ` Thomas Monjalon
@ 2019-02-13 11:48                     ` Luca Boccassi
  1 sibling, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 11:48 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson; +Cc: dev

On Wed, 2019-02-13 at 10:49 +0000, Luca Boccassi wrote:
> On Tue, 2019-02-12 at 17:21 +0100, Thomas Monjalon wrote:
> > 12/02/2019 16:03, Bruce Richardson:
> > > On Tue, Feb 12, 2019 at 03:47:56PM +0100, Thomas Monjalon wrote:
> > > > 12/02/2019 12:43, Bruce Richardson:
> > > > > On Tue, Feb 12, 2019 at 12:36:17PM +0100, Thomas Monjalon
> > > > > wrote:
> > > > > > 12/02/2019 12:31, Bruce Richardson:
> > > > > > > On Tue, Feb 12, 2019 at 12:15:43PM +0100, Thomas Monjalon
> > > > > > > wrote:
> > > > > > > > 06/02/2019 18:08, Luca Boccassi:
> > > > > > > > > Whenever possible (if the library ships a pkg-config
> > > > > > > > > file) use meson's
> > > > > > > > > dependency() function to look for it, as it will
> > > > > > > > > automatically add it
> > > > > > > > > to the Requires.private list if needed, to allow for
> > > > > > > > > static builds to
> > > > > > > > > succeed for reverse dependencies of DPDK. Otherwise
> > > > > > > > > the
> > > > > > > > > recursive
> > > > > > > > > dependencies are not parsed, and users doing static
> > > > > > > > > builds have to
> > > > > > > > > resolve them manually by themselves.
> > > > > > > > > When using this API avoid additional checks that are
> > > > > > > > > superfluous and
> > > > > > > > > take extra time, and avoid adding the linker flag
> > > > > > > > > manually which causes
> > > > > > > > > it to be duplicated.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > > > > > Acked-by: Bruce Richardson <bruce.richardson@intel.co
> > > > > > > > > m>
> > > > > > > > 
> > > > > > > > This patch breaks compilation on my machine with a lot
> > > > > > > > of
> > > > > > > > strange errors:
> > > > > > > > 
> > > > > > > > from drivers/net/pcap/rte_eth_pcap.c
> > > > > > > > 
> > > > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > > > /usr/include/bits/stdlib-bsearch.h:32:13: error: cast
> > > > > > > > discards 'const' qualifier from pointer target type
> > > > > > > > /usr/include/pthread.h:682:6: error: 'regparm'
> > > > > > > > attribute
> > > > > > > > directive ignored
> > > > > > > > etc
> > > > > > > > 
> > > > > > > 
> > > > > > > Is this on Arch linux again? I just reverified these
> > > > > > > first
> > > > > > > two patches and
> > > > > > > they work fine for me on Fedora (I assume Luca probably
> > > > > > > tested them already on
> > > > > > > Debian) 
> > > > > > > 
> > > > > > > Anything unusual about your setup?
> > > > > > 
> > > > > > Nothing unusual. Just using the best environment ever ;)
> > > > > > I will try to debug it.
> > > > > > 
> > > > > 
> > > > > It may be something pcap-specific, since pcap has to have
> > > > > it's
> > > > > own special
> > > > > query mechanims outside the normal pkg-config one. If you
> > > > > remove the
> > > > > pcap-driver changes, does the rest of the patch work for you?
> > > > 
> > > > Yes, the issue happens only with pcap on Arm.
> > > > Reverting the pcap related changes, it builds fine.
> > > > 
> > > > More infos about my setup:
> > > > 	meson-0.49.1
> > > > 	aarch64-linux-gnu-gcc-8.2.0
> > > > 	libpcap-1.9.0 (32 and 64-bit) for x86
> > > > 
> > > > I think there is a mix between libcap for x86 and Arm
> > > > compilation.
> > > > Probably a meson bug?
> > > > 
> > > 
> > > Could well be a meson issue. It may be using the local pcap-
> > > config
> > > rather
> > > than the cross-compilation version [assuming cross-compilation
> > > here, though
> > > I don't see the issue with my setup].
> > > 
> > > Thomas, can you apply this set with the pcap driver change
> > > dropped,
> > > or is it better if Luca does a new version of this set?
> > 
> > I think we need a comment about the pcap miss.
> > Probably better to do a new version.
> > 
> > Luca, please could you test cross-compilation?
> 
> Hi,
> 
> I would, except downloading the toolchain from Linaro fails with 403
> forbidden...
> 
> https://releases.linaro.org/components/toolchain/binaries/latest/aarc
> h64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-
> gnu.tar.xz
> 
> I'll try with Debian's cross compiler

I think the issue is that I'm going in circles:

https://git.dpdk.org/dpdk/commit/?id=d1e4a5b7320905f025e7caea685708b5eea37456
https://git.dpdk.org/dpdk/commit/?id=6930c0403a1754eb5cab89577565eefa5a9995a1

As Bruce said, the root cause is libpcap's lack of a pkg-config file
and usage of a custom tool, which is a known bane for cross compilers.
The good news is that 1.9.0 finally added a pkg-config file in
addition:

https://github.com/the-tcpdump-group/libpcap/commit/a7deb6a241f8c71ca261adc45ac07c8427074792

Given cross-compilation doesn't work at all for me, I'll do a v7 without that snippet.

-- 
Kind regards,
Luca Boccassi

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

* [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
                   ` (5 preceding siblings ...)
  2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
@ 2019-02-13 11:54 ` Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 2/5] build: use dependency() instead of find_library() Luca Boccassi
                     ` (3 more replies)
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
  7 siblings, 4 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 11:54 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Meson 0.47.1 fixed a bug that is difficult to work around, which causes
the linker flag of dependencies to be repeated dozens of times, which
causes issues especially when using the built-in dependency() API.
Bump the minimum version and remove obsolete version checks.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug
v3: split away first independent patch from series
v4: add acked-by

 drivers/meson.build      |  5 +----
 kernel/linux/meson.build |  6 +-----
 meson.build              | 35 +++++++++++++++--------------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..e37d4fe2b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -148,8 +148,5 @@ foreach class:driver_classes
 		endif # build
 	endforeach
 
-	if meson.version().version_compare('>=0.47')
-		# prior to 0.47, set_variable can't take array params
-		set_variable(class + '_drivers', class_drivers)
-	endif
+	set_variable(class + '_drivers', class_drivers)
 endforeach
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index 5b7ec06e1..d751d939f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -27,11 +27,7 @@ else
 	make_returncode = run_command('make', '-sC', kernel_dir,
 			'kernelversion').returncode()
 	if make_returncode != 0
-		if meson.version().version_compare('>=0.44')
-			warning(WARN_NO_HEADERS)
-		else
-			message('WARNING: ' + WARN_NO_HEADERS)
-		endif
+		warning(WARN_NO_HEADERS)
 	else # returncode == 0
 
 # DO ACTUAL MODULE BUILDING
diff --git a/meson.build b/meson.build
index 7f5e8674b..e9793b127 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.05.0-rc0',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
@@ -105,23 +105,18 @@ foreach lib:enabled_libs
 endforeach
 message(output_message + '\n')
 
-
-# prior to 0.47 set_variable didn't work with arrays, so we can't
-# track driver lists easily
-if meson.version().version_compare('>=0.47')
-	output_message = '\n===============\nDrivers Enabled\n===============\n'
-	foreach class:driver_classes
-		class_drivers = get_variable(class + '_drivers')
-		output_message += '\n' + class + ':\n\t'
-		output_count = 0
-		foreach drv:class_drivers
-			output_message += drv + ', '
-			output_count += 1
-			if output_count == 8
-				output_message += '\n\t'
-				output_count = 0
-			endif
-		endforeach
+output_message = '\n===============\nDrivers Enabled\n===============\n'
+foreach class:driver_classes
+	class_drivers = get_variable(class + '_drivers')
+	output_message += '\n' + class + ':\n\t'
+	output_count = 0
+	foreach drv:class_drivers
+		output_message += drv + ', '
+		output_count += 1
+		if output_count == 8
+			output_message += '\n\t'
+			output_count = 0
+		endif
 	endforeach
-	message(output_message + '\n')
-endif
+endforeach
+message(output_message + '\n')
-- 
2.20.1

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

* [PATCH v7 2/5] build: use dependency() instead of find_library()
  2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
@ 2019-02-13 11:54   ` Luca Boccassi
  2019-02-13 15:35     ` Bruce Richardson
  2019-02-13 11:54   ` [PATCH v7 3/5] build: reorder libraries and build eal before cmdline Luca Boccassi
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 11:54 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluous and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required
v4: update comment in drivers/meson.build to clarify role of
    pkgconfig_extra_libs
v5: remove -lz from drivers/compress/zlib
v7: remove change from pcap pmd, as it's causing issues with
    cross-compilation due to missing pkg-config file

 drivers/compress/zlib/meson.build  | 1 -
 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 9 +++++----
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 10 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/compress/zlib/meson.build b/drivers/compress/zlib/meson.build
index 7748de2df..b036703c7 100644
--- a/drivers/compress/zlib/meson.build
+++ b/drivers/compress/zlib/meson.build
@@ -9,6 +9,5 @@ endif
 deps += 'bus_vdev'
 sources = files('zlib_pmd.c', 'zlib_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lz'
 
 allow_experimental_apis = true
diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index 77a6596d7..d56a32366 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -9,4 +9,3 @@ allow_experimental_apis = true
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index e37d4fe2b..69d0556d3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,10 +46,11 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
-		# probably also need to specify the "-l" flags in
-		# pkgconfig_extra_libs variable too, so that it can be reflected
-		# in the pkgconfig output for static builds
+		# using dependency() (preferred) or find_library().
+		# For the find_library() case (but not with dependency()) we also
+		# need to specify the "-l" flags in pkgconfig_extra_libs variable
+		# too, so that it can be reflected in the pkgconfig output for
+		# static builds.
 		ext_deps = []
 		pkgconfig_extra_libs = []
 
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 4bccd68e0..b4f9672e7 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 4540c455b..0cf2f0873 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
-- 
2.20.1

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

* [PATCH v7 3/5] build: reorder libraries and build eal before cmdline
  2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 2/5] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-02-13 11:54   ` Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 4/5] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 5/5] build: use integers for numerical options Luca Boccassi
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 11:54 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Most libraries and PMDs depend on eal, and eal depends only on kvargs,
so reorder the list in Meson to reflect this and take advantage of this
dependency chain.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: added this patch to let the next just update librte_eal instead of
    also having to update rte_cmdline
v4: add acked-by

 lib/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index e8b40f546..074a8b8b4 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,9 +9,10 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [ 'compat', # just a header, used for versioning
-	'cmdline', # ethdev depends on cmdline for parsing functions
 	'kvargs', # eal depends on kvargs
-	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
+	'eal', # everything depends on eal
+	'cmdline', # ethdev depends on cmdline for parsing functions
+	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
 	'metrics', # bitrate/latency stats depends on this
 	'hash',    # efd depends on this
 	'timer',   # eventdev depends on this
-- 
2.20.1

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

* [PATCH v7 4/5] build: use dependency() for libbsd instead of manual append to ldflags
  2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 2/5] build: use dependency() instead of find_library() Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 3/5] build: reorder libraries and build eal before cmdline Luca Boccassi
@ 2019-02-13 11:54   ` Luca Boccassi
  2019-02-13 11:54   ` [PATCH v7 5/5] build: use integers for numerical options Luca Boccassi
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 11:54 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: only add dependency to librte_eal and let it propagate from there
v4: add acked-by

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@ version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
-- 
2.20.1

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

* [PATCH v7 5/5] build: use integers for numerical options
  2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
                     ` (2 preceding siblings ...)
  2019-02-13 11:54   ` [PATCH v7 4/5] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
@ 2019-02-13 11:54   ` Luca Boccassi
  3 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 11:54 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Luca Boccassi

Now that the minimum Meson version has been bumped past 0.45 we can use
integer as an option type directly.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v6: added following Bruce's suggestion
v7: add acked-by

 meson_options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 574054597..4e178178f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,9 +18,9 @@ option('lib_musdk_dir', type: 'string', value: '',
 	description: 'path to the MUSDK library installation directory')
 option('machine', type: 'string', value: 'native',
 	description: 'set the target machine type')
-option('max_lcores', type: 'string', value: '128',
+option('max_lcores', type: 'integer', value: 128,
 	description: 'maximum number of cores/threads supported by EAL')
-option('max_numa_nodes', type: 'string', value: '4',
+option('max_numa_nodes', type: 'integer', value: 4,
 	description: 'maximum number of NUMA nodes supported by EAL')
 option('per_library_versions', type: 'boolean', value: true,
 	description: 'true: each lib gets its own version number, false: DPDK version used for each lib')
-- 
2.20.1

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

* Re: [PATCH v6 2/5] build: use dependency() instead of find_library()
  2019-02-13 11:10                     ` Thomas Monjalon
@ 2019-02-13 13:45                       ` Luca Boccassi
  0 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-02-13 13:45 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Bruce Richardson, dev

On Wed, 2019-02-13 at 12:10 +0100, Thomas Monjalon wrote:
> 13/02/2019 11:49, Luca Boccassi:
> > On Tue, 2019-02-12 at 17:21 +0100, Thomas Monjalon wrote:
> > > Luca, please could you test cross-compilation?
> > 
> > Hi,
> > 
> > I would, except downloading the toolchain from Linaro fails with
> > 403
> > forbidden...
> > 
> > https://releases.linaro.org/components/toolchain/binaries/latest/aa
> > rch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-
> > gnu.tar.xz
> > 
> > I'll try with Debian's cross compiler
> 
> You can also test this one: https://toolchains.bootlin.com/

That one works - the pcap-config issue can be patched over by setting
pcap-config = '' in the cross-build config files in config/arm/ - but
the dependency finder needs to fallback to find_library. This series
has seen enough revisions already and it's not a critical path, so I'll
do it separately another time.

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v7 2/5] build: use dependency() instead of find_library()
  2019-02-13 11:54   ` [PATCH v7 2/5] build: use dependency() instead of find_library() Luca Boccassi
@ 2019-02-13 15:35     ` Bruce Richardson
  0 siblings, 0 replies; 88+ messages in thread
From: Bruce Richardson @ 2019-02-13 15:35 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Wed, Feb 13, 2019 at 11:54:49AM +0000, Luca Boccassi wrote:
> Whenever possible (if the library ships a pkg-config file) use meson's
> dependency() function to look for it, as it will automatically add it
> to the Requires.private list if needed, to allow for static builds to
> succeed for reverse dependencies of DPDK. Otherwise the recursive
> dependencies are not parsed, and users doing static builds have to
> resolve them manually by themselves.
> When using this API avoid additional checks that are superfluous and
> take extra time, and avoid adding the linker flag manually which causes
> it to be duplicated.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> v2: split libbsd change in a separate commit, remove CC to stable
>     as a meson bump will be required
> v4: update comment in drivers/meson.build to clarify role of
>     pkgconfig_extra_libs
> v5: remove -lz from drivers/compress/zlib
> v7: remove change from pcap pmd, as it's causing issues with
>     cross-compilation due to missing pkg-config file
> 
I reproduced the compilation errors on cross compile with the older version
of this patch. Using this latest version I don't see them any more.

Tested-by: Bruce Richardson <bruce.richardson@intel.com>

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

* [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1
  2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
                   ` (6 preceding siblings ...)
  2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
@ 2019-02-26 17:46 ` luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 2/6] build: use dependency() instead of find_library() luca.boccassi
                     ` (5 more replies)
  7 siblings, 6 replies; 88+ messages in thread
From: luca.boccassi @ 2019-02-26 17:46 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

From: Luca Boccassi <bluca@debian.org>

Meson 0.47.1 fixed a bug that is difficult to work around, which causes
the linker flag of dependencies to be repeated dozens of times, which
causes issues especially when using the built-in dependency() API.
Bump the minimum version and remove obsolete version checks.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug
v3: split away first independent patch from series
v4: add acked-by

 drivers/meson.build      |  5 +----
 kernel/linux/meson.build |  6 +-----
 meson.build              | 35 +++++++++++++++--------------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index c3c66bbc0..e37d4fe2b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -148,8 +148,5 @@ foreach class:driver_classes
 		endif # build
 	endforeach
 
-	if meson.version().version_compare('>=0.47')
-		# prior to 0.47, set_variable can't take array params
-		set_variable(class + '_drivers', class_drivers)
-	endif
+	set_variable(class + '_drivers', class_drivers)
 endforeach
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index 5b7ec06e1..d751d939f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -27,11 +27,7 @@ else
 	make_returncode = run_command('make', '-sC', kernel_dir,
 			'kernelversion').returncode()
 	if make_returncode != 0
-		if meson.version().version_compare('>=0.44')
-			warning(WARN_NO_HEADERS)
-		else
-			message('WARNING: ' + WARN_NO_HEADERS)
-		endif
+		warning(WARN_NO_HEADERS)
 	else # returncode == 0
 
 # DO ACTUAL MODULE BUILDING
diff --git a/meson.build b/meson.build
index 2bbd42bc8..69833de82 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('DPDK', 'C',
 	version: '19.05.0-rc0',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.41'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.
@@ -104,23 +104,18 @@ foreach lib:enabled_libs
 endforeach
 message(output_message + '\n')
 
-
-# prior to 0.47 set_variable didn't work with arrays, so we can't
-# track driver lists easily
-if meson.version().version_compare('>=0.47')
-	output_message = '\n===============\nDrivers Enabled\n===============\n'
-	foreach class:driver_classes
-		class_drivers = get_variable(class + '_drivers')
-		output_message += '\n' + class + ':\n\t'
-		output_count = 0
-		foreach drv:class_drivers
-			output_message += drv + ', '
-			output_count += 1
-			if output_count == 8
-				output_message += '\n\t'
-				output_count = 0
-			endif
-		endforeach
+output_message = '\n===============\nDrivers Enabled\n===============\n'
+foreach class:driver_classes
+	class_drivers = get_variable(class + '_drivers')
+	output_message += '\n' + class + ':\n\t'
+	output_count = 0
+	foreach drv:class_drivers
+		output_message += drv + ', '
+		output_count += 1
+		if output_count == 8
+			output_message += '\n\t'
+			output_count = 0
+		endif
 	endforeach
-	message(output_message + '\n')
-endif
+endforeach
+message(output_message + '\n')
-- 
2.20.1

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

* [PATCH v8 2/6] build: use dependency() instead of find_library()
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
@ 2019-02-26 17:46   ` luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 3/6] build: reorder libraries and build eal before cmdline luca.boccassi
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 88+ messages in thread
From: luca.boccassi @ 2019-02-26 17:46 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

From: Luca Boccassi <bluca@debian.org>

Whenever possible (if the library ships a pkg-config file) use meson's
dependency() function to look for it, as it will automatically add it
to the Requires.private list if needed, to allow for static builds to
succeed for reverse dependencies of DPDK. Otherwise the recursive
dependencies are not parsed, and users doing static builds have to
resolve them manually by themselves.
When using this API avoid additional checks that are superfluous and
take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2: split libbsd change in a separate commit, remove CC to stable
    as a meson bump will be required
v4: update comment in drivers/meson.build to clarify role of
    pkgconfig_extra_libs
v5: remove -lz from drivers/compress/zlib
v7: remove change from pcap pmd, as it's causing issues with
    cross-compilation due to missing pkg-config file

 drivers/compress/zlib/meson.build  | 1 -
 drivers/crypto/ccp/meson.build     | 1 -
 drivers/crypto/openssl/meson.build | 1 -
 drivers/crypto/qat/meson.build     | 1 -
 drivers/meson.build                | 9 +++++----
 drivers/net/bnx2x/meson.build      | 2 +-
 drivers/net/mlx4/meson.build       | 6 +++---
 drivers/net/mlx5/meson.build       | 6 +++---
 lib/librte_bpf/meson.build         | 4 ++--
 lib/librte_telemetry/meson.build   | 2 +-
 10 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/compress/zlib/meson.build b/drivers/compress/zlib/meson.build
index 7748de2df..b036703c7 100644
--- a/drivers/compress/zlib/meson.build
+++ b/drivers/compress/zlib/meson.build
@@ -9,6 +9,5 @@ endif
 deps += 'bus_vdev'
 sources = files('zlib_pmd.c', 'zlib_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lz'
 
 allow_experimental_apis = true
diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build
index e43b00591..915c4c854 100644
--- a/drivers/crypto/ccp/meson.build
+++ b/drivers/crypto/ccp/meson.build
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index 77a6596d7..d56a32366 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -9,4 +9,3 @@ allow_experimental_apis = true
 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 9cc98d2c2..21f969735 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -13,6 +13,5 @@ if dep.found()
 			     'qat_sym.c',
 			     'qat_sym_session.c')
 	qat_ext_deps += dep
-	pkgconfig_extra_libs += '-lcrypto'
 	qat_cflags += '-DBUILD_QAT_SYM'
 endif
diff --git a/drivers/meson.build b/drivers/meson.build
index e37d4fe2b..69d0556d3 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -46,10 +46,11 @@ foreach class:driver_classes
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
 		# ext_deps: Stores external library dependency got
-		# using dependency() or cc.find_library(). For most cases, we
-		# probably also need to specify the "-l" flags in
-		# pkgconfig_extra_libs variable too, so that it can be reflected
-		# in the pkgconfig output for static builds
+		# using dependency() (preferred) or find_library().
+		# For the find_library() case (but not with dependency()) we also
+		# need to specify the "-l" flags in pkgconfig_extra_libs variable
+		# too, so that it can be reflected in the pkgconfig output for
+		# static builds.
 		ext_deps = []
 		pkgconfig_extra_libs = []
 
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c688869..dd189ffc4 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-dep = cc.find_library('z', required: false)
+dep = dependency('zlib', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index 4bccd68e0..b4f9672e7 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx4', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx4', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 4540c455b..0cf2f0873 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -14,9 +14,9 @@ if pmd_dlopen
 	]
 endif
 libs = [
-	cc.find_library('mnl', required:false),
-	cc.find_library('mlx5', required:false),
-	cc.find_library('ibverbs', required:false),
+	dependency('libmnl', required:false),
+	dependency('libmlx5', required:false),
+	dependency('libibverbs', required:false),
 ]
 build = true
 foreach lib:libs
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..c3b1f698e 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = cc.find_library('elf', required: false)
-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep)
+dep = dependency('libelf', required: false)
+if dep.found()
 	sources += files('bpf_load_elf.c')
 	ext_deps += dep
 endif
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f544e..cafb26f08 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
 
-jansson = cc.find_library('jansson', required: false)
+jansson = dependency('jansson', required: false)
 if jansson.found()
 	ext_deps += jansson
 	dpdk_app_link_libraries += ['telemetry']
-- 
2.20.1

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

* [PATCH v8 3/6] build: reorder libraries and build eal before cmdline
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 2/6] build: use dependency() instead of find_library() luca.boccassi
@ 2019-02-26 17:46   ` luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 4/6] build: use dependency() for libbsd instead of manual append to ldflags luca.boccassi
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 88+ messages in thread
From: luca.boccassi @ 2019-02-26 17:46 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

From: Luca Boccassi <bluca@debian.org>

Most libraries and PMDs depend on eal, and eal depends only on kvargs,
so reorder the list in Meson to reflect this and take advantage of this
dependency chain.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: added this patch to let the next just update librte_eal instead of
    also having to update rte_cmdline
v4: add acked-by
v8: rebased on latest master to fix merge conflict

 lib/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index edcccdcb6..99957ba7d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,9 +9,10 @@
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
 libraries = [
-	'cmdline', # ethdev depends on cmdline for parsing functions
 	'kvargs', # eal depends on kvargs
-	'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
+	'eal', # everything depends on eal
+	'cmdline', # ethdev depends on cmdline for parsing functions
+	'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
 	'metrics', # bitrate/latency stats depends on this
 	'hash',    # efd depends on this
 	'timer',   # eventdev depends on this
-- 
2.20.1

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

* [PATCH v8 4/6] build: use dependency() for libbsd instead of manual append to ldflags
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 2/6] build: use dependency() instead of find_library() luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 3/6] build: reorder libraries and build eal before cmdline luca.boccassi
@ 2019-02-26 17:46   ` luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 5/6] build: use integers for numerical options luca.boccassi
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 88+ messages in thread
From: luca.boccassi @ 2019-02-26 17:46 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

From: Luca Boccassi <bluca@debian.org>

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3: only add dependency to librte_eal and let it propagate from there
v4: add acked-by

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index 64d857a4a..98c1d1f31 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -24,6 +24,9 @@ endif
 version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
-- 
2.20.1

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

* [PATCH v8 5/6] build: use integers for numerical options
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
                     ` (2 preceding siblings ...)
  2019-02-26 17:46   ` [PATCH v8 4/6] build: use dependency() for libbsd instead of manual append to ldflags luca.boccassi
@ 2019-02-26 17:46   ` luca.boccassi
  2019-02-26 17:46   ` [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library luca.boccassi
  2019-02-27 11:29   ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 Thomas Monjalon
  5 siblings, 0 replies; 88+ messages in thread
From: luca.boccassi @ 2019-02-26 17:46 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

From: Luca Boccassi <bluca@debian.org>

Now that the minimum Meson version has been bumped past 0.45 we can use
integer as an option type directly.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v6: added following Bruce's suggestion
v7: add acked-by

 meson_options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 574054597..4e178178f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,9 +18,9 @@ option('lib_musdk_dir', type: 'string', value: '',
 	description: 'path to the MUSDK library installation directory')
 option('machine', type: 'string', value: 'native',
 	description: 'set the target machine type')
-option('max_lcores', type: 'string', value: '128',
+option('max_lcores', type: 'integer', value: 128,
 	description: 'maximum number of cores/threads supported by EAL')
-option('max_numa_nodes', type: 'string', value: '4',
+option('max_numa_nodes', type: 'integer', value: 4,
 	description: 'maximum number of NUMA nodes supported by EAL')
 option('per_library_versions', type: 'boolean', value: true,
 	description: 'true: each lib gets its own version number, false: DPDK version used for each lib')
-- 
2.20.1

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

* [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
                     ` (3 preceding siblings ...)
  2019-02-26 17:46   ` [PATCH v8 5/6] build: use integers for numerical options luca.boccassi
@ 2019-02-26 17:46   ` luca.boccassi
  2019-02-26 17:49     ` Luca Boccassi
  2019-03-01 13:22     ` Thomas Monjalon
  2019-02-27 11:29   ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 Thomas Monjalon
  5 siblings, 2 replies; 88+ messages in thread
From: luca.boccassi @ 2019-02-26 17:46 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

From: Luca Boccassi <luca.boccassi@microsoft.com>

pcap has historically shipped a custom pcap-config binary tool which
does the job of pkg-config. It was never compatible with cross
compilation.
Meson uses it when using dependency(), which then means cross
compilation fails.
Set pcap-config to empty in the meson cross compilation files so
that Meson will not use it, and add a fallback in case
dependency() fails.
libpcap 1.9.0 finally ships a pkg-config file so everything will
work out of the box in the future.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
---
v8: added back pcap change separately. Tested with bootlin
    cross-compilation toolchain, everything seems to work.

 config/arm/arm64_armv8_linuxapp_gcc    |  1 +
 config/arm/arm64_dpaa2_linuxapp_gcc    |  1 +
 config/arm/arm64_dpaa_linuxapp_gcc     |  1 +
 config/arm/arm64_thunderx_linuxapp_gcc |  1 +
 drivers/net/pcap/meson.build           | 16 ++++++++++++----
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/config/arm/arm64_armv8_linuxapp_gcc b/config/arm/arm64_armv8_linuxapp_gcc
index 987c02fbb..513760917 100644
--- a/config/arm/arm64_armv8_linuxapp_gcc
+++ b/config/arm/arm64_armv8_linuxapp_gcc
@@ -3,6 +3,7 @@ c = 'aarch64-linux-gnu-gcc'
 cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/config/arm/arm64_dpaa2_linuxapp_gcc b/config/arm/arm64_dpaa2_linuxapp_gcc
index 7ec74ec4b..0df8c8f7d 100644
--- a/config/arm/arm64_dpaa2_linuxapp_gcc
+++ b/config/arm/arm64_dpaa2_linuxapp_gcc
@@ -4,6 +4,7 @@ cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-ar'
 as = 'aarch64-linux-gnu-as'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/config/arm/arm64_dpaa_linuxapp_gcc b/config/arm/arm64_dpaa_linuxapp_gcc
index 73a8f0b81..f4b85a84b 100644
--- a/config/arm/arm64_dpaa_linuxapp_gcc
+++ b/config/arm/arm64_dpaa_linuxapp_gcc
@@ -4,6 +4,7 @@ cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-ar'
 as = 'aarch64-linux-gnu-as'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 967d9d46d..14b801998 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -3,6 +3,7 @@ c = 'aarch64-linux-gnu-gcc'
 cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..2c2fd11e4 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
-	build = false
+	# pcap got a pkg-config file only in 1.9.0 and before that meson uses
+	# an internal pcap-config finder, which is not compatible with
+	# cross-compilation, so try to fallback to find_library
+	pcap_dep = cc.find_library('pcap', required: false)
+	if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+		build = true
+		pkgconfig_extra_libs += '-lpcap'
+	else
+		build = false
+	endif
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'
-- 
2.20.1

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-26 17:46   ` [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library luca.boccassi
@ 2019-02-26 17:49     ` Luca Boccassi
  2019-02-27  8:33       ` Thomas Monjalon
  2019-03-01 13:22     ` Thomas Monjalon
  1 sibling, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-02-26 17:49 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, thomas

On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <luca.boccassi@microsoft.com>
> 
> pcap has historically shipped a custom pcap-config binary tool which
> does the job of pkg-config. It was never compatible with cross
> compilation.
> Meson uses it when using dependency(), which then means cross
> compilation fails.
> Set pcap-config to empty in the meson cross compilation files so
> that Meson will not use it, and add a fallback in case
> dependency() fails.
> libpcap 1.9.0 finally ships a pkg-config file so everything will
> work out of the box in the future.
> 
> Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> ---
> v8: added back pcap change separately. Tested with bootlin
>     cross-compilation toolchain, everything seems to work.

I had some time to invest so I added back this change, in a way that
works with cross compilation too. Given the series wasn't merged yet
and there was a conflict I've done a v8 rather than a single separate
patch, but it's independent from the rest.

More testing is of course welcome!

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-26 17:49     ` Luca Boccassi
@ 2019-02-27  8:33       ` Thomas Monjalon
  2019-02-27  9:47         ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-27  8:33 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, bruce.richardson

26/02/2019 18:49, Luca Boccassi:
> On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > 
> > pcap has historically shipped a custom pcap-config binary tool which
> > does the job of pkg-config. It was never compatible with cross
> > compilation.
> > Meson uses it when using dependency(), which then means cross
> > compilation fails.
> > Set pcap-config to empty in the meson cross compilation files so
> > that Meson will not use it, and add a fallback in case
> > dependency() fails.
> > libpcap 1.9.0 finally ships a pkg-config file so everything will
> > work out of the box in the future.
> > 
> > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > ---
> > v8: added back pcap change separately. Tested with bootlin
> >     cross-compilation toolchain, everything seems to work.
> 
> I had some time to invest so I added back this change, in a way that
> works with cross compilation too. Given the series wasn't merged yet
> and there was a conflict I've done a v8 rather than a single separate
> patch, but it's independent from the rest.
> 
> More testing is of course welcome!

I still see the same error when cross-compiling:

/usr/include/stdint.h:109: error: "__INT64_C" redefined

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-27  8:33       ` Thomas Monjalon
@ 2019-02-27  9:47         ` Bruce Richardson
  2019-02-27 10:50           ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-02-27  9:47 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Luca Boccassi, dev

On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> 26/02/2019 18:49, Luca Boccassi:
> > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > 
> > > pcap has historically shipped a custom pcap-config binary tool which
> > > does the job of pkg-config. It was never compatible with cross
> > > compilation.
> > > Meson uses it when using dependency(), which then means cross
> > > compilation fails.
> > > Set pcap-config to empty in the meson cross compilation files so
> > > that Meson will not use it, and add a fallback in case
> > > dependency() fails.
> > > libpcap 1.9.0 finally ships a pkg-config file so everything will
> > > work out of the box in the future.
> > > 
> > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > ---
> > > v8: added back pcap change separately. Tested with bootlin
> > >     cross-compilation toolchain, everything seems to work.
> > 
> > I had some time to invest so I added back this change, in a way that
> > works with cross compilation too. Given the series wasn't merged yet
> > and there was a conflict I've done a v8 rather than a single separate
> > patch, but it's independent from the rest.
> > 
> > More testing is of course welcome!
> 
> I still see the same error when cross-compiling:
> 
> /usr/include/stdint.h:109: error: "__INT64_C" redefined
> 
Can patches 1-5 be merged anyway, leaving 6 for later?

/Bruce

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-27  9:47         ` Bruce Richardson
@ 2019-02-27 10:50           ` Luca Boccassi
  2019-02-27 10:56             ` Thomas Monjalon
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-02-27 10:50 UTC (permalink / raw)
  To: Bruce Richardson, Thomas Monjalon; +Cc: dev

On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > 26/02/2019 18:49, Luca Boccassi:
> > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > 
> > > > pcap has historically shipped a custom pcap-config binary tool
> > > > which
> > > > does the job of pkg-config. It was never compatible with cross
> > > > compilation.
> > > > Meson uses it when using dependency(), which then means cross
> > > > compilation fails.
> > > > Set pcap-config to empty in the meson cross compilation files
> > > > so
> > > > that Meson will not use it, and add a fallback in case
> > > > dependency() fails.
> > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > will
> > > > work out of the box in the future.
> > > > 
> > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > ---
> > > > v8: added back pcap change separately. Tested with bootlin
> > > >     cross-compilation toolchain, everything seems to work.
> > > 
> > > I had some time to invest so I added back this change, in a way
> > > that
> > > works with cross compilation too. Given the series wasn't merged
> > > yet
> > > and there was a conflict I've done a v8 rather than a single
> > > separate
> > > patch, but it's independent from the rest.
> > > 
> > > More testing is of course welcome!
> > 
> > I still see the same error when cross-compiling:
> > 
> > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > 
> Can patches 1-5 be merged anyway, leaving 6 for later?
> 
> /Bruce

Yes please...

Thomas, could you please give me detailed instructions on how to repro?
I used the bootlin toolchain you linked me last time, and passed --
cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and everything
built fine both with and without an arm64 build of libpcap in the
sysroot. With the previous version that I removed it would fail. Not
sure what I'm missing!

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-27 10:50           ` Luca Boccassi
@ 2019-02-27 10:56             ` Thomas Monjalon
  2019-02-27 12:03               ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-27 10:56 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: Bruce Richardson, dev

27/02/2019 11:50, Luca Boccassi:
> On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > 26/02/2019 18:49, Luca Boccassi:
> > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > 
> > > > > pcap has historically shipped a custom pcap-config binary tool
> > > > > which
> > > > > does the job of pkg-config. It was never compatible with cross
> > > > > compilation.
> > > > > Meson uses it when using dependency(), which then means cross
> > > > > compilation fails.
> > > > > Set pcap-config to empty in the meson cross compilation files
> > > > > so
> > > > > that Meson will not use it, and add a fallback in case
> > > > > dependency() fails.
> > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > will
> > > > > work out of the box in the future.
> > > > > 
> > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > ---
> > > > > v8: added back pcap change separately. Tested with bootlin
> > > > >     cross-compilation toolchain, everything seems to work.
> > > > 
> > > > I had some time to invest so I added back this change, in a way
> > > > that
> > > > works with cross compilation too. Given the series wasn't merged
> > > > yet
> > > > and there was a conflict I've done a v8 rather than a single
> > > > separate
> > > > patch, but it's independent from the rest.
> > > > 
> > > > More testing is of course welcome!
> > > 
> > > I still see the same error when cross-compiling:
> > > 
> > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > 
> > Can patches 1-5 be merged anyway, leaving 6 for later?
> > 
> > /Bruce
> 
> Yes please...

Yes, sure. I am checking other patches to push them.

> Thomas, could you please give me detailed instructions on how to repro?
> I used the bootlin toolchain you linked me last time, and passed --
> cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and everything
> built fine both with and without an arm64 build of libpcap in the
> sysroot. With the previous version that I removed it would fail. Not
> sure what I'm missing!

I'm running devtools/test-meson-builds.sh on my ArchLinux which has
aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.

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

* Re: [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1
  2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
                     ` (4 preceding siblings ...)
  2019-02-26 17:46   ` [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library luca.boccassi
@ 2019-02-27 11:29   ` Thomas Monjalon
  5 siblings, 0 replies; 88+ messages in thread
From: Thomas Monjalon @ 2019-02-27 11:29 UTC (permalink / raw)
  To: luca.boccassi; +Cc: dev, bruce.richardson

26/02/2019 18:46, luca.boccassi@gmail.com:
> From: Luca Boccassi <bluca@debian.org>
> 
> Meson 0.47.1 fixed a bug that is difficult to work around, which causes
> the linker flag of dependencies to be repeated dozens of times, which
> causes issues especially when using the built-in dependency() API.
> Bump the minimum version and remove obsolete version checks.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Series applied without the last patch, thanks.

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-27 10:56             ` Thomas Monjalon
@ 2019-02-27 12:03               ` Luca Boccassi
  2019-02-27 13:53                 ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Luca Boccassi @ 2019-02-27 12:03 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Bruce Richardson, dev

On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> 27/02/2019 11:50, Luca Boccassi:
> > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > wrote:
> > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > 
> > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > tool
> > > > > > which
> > > > > > does the job of pkg-config. It was never compatible with
> > > > > > cross
> > > > > > compilation.
> > > > > > Meson uses it when using dependency(), which then means
> > > > > > cross
> > > > > > compilation fails.
> > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > files
> > > > > > so
> > > > > > that Meson will not use it, and add a fallback in case
> > > > > > dependency() fails.
> > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > will
> > > > > > work out of the box in the future.
> > > > > > 
> > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > ---
> > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > 
> > > > > I had some time to invest so I added back this change, in a
> > > > > way
> > > > > that
> > > > > works with cross compilation too. Given the series wasn't
> > > > > merged
> > > > > yet
> > > > > and there was a conflict I've done a v8 rather than a single
> > > > > separate
> > > > > patch, but it's independent from the rest.
> > > > > 
> > > > > More testing is of course welcome!
> > > > 
> > > > I still see the same error when cross-compiling:
> > > > 
> > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > 
> > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > 
> > > /Bruce
> > 
> > Yes please...
> 
> Yes, sure. I am checking other patches to push them.

Thanks!

> > Thomas, could you please give me detailed instructions on how to
> > repro?
> > I used the bootlin toolchain you linked me last time, and passed --
> > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > everything
> > built fine both with and without an arm64 build of libpcap in the
> > sysroot. With the previous version that I removed it would fail.
> > Not
> > sure what I'm missing!
> 
> I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.

The script is working fine too - I have the toolchain in /tmp so I
simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
fine including the arm targets.

The key part in the patch was adding pcap-config = '' to the various
arm configs, could you please double check that it was applied
correctly? Without that, Meson finds and calls the native pcap-config
which gives wrong (native) flags and causes the errors you are seeing.
Otherwise I'm a bit lost, I can't understand why it's all working here
and not there.

meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
The Meson build system
Version: 0.49.2
Source dir: /home/bluca/git/dpdk
Build dir: /home/bluca/git/dpdk/build-arm64-armv8
Build type: cross build
Project name: DPDK
Project version: 19.05.0-rc0
Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
Host machine cpu family: aarch64
Host machine cpu: armv8-a
Target machine cpu family: aarch64
Target machine cpu: armv8-a
<...>
$ file build-arm64-armv8/lib/librte_eal.so.9.1 
build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped

-- 
Kind regards,
Luca Boccassi

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-27 12:03               ` Luca Boccassi
@ 2019-02-27 13:53                 ` Bruce Richardson
  2019-02-28 17:40                   ` Bruce Richardson
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-02-27 13:53 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: Thomas Monjalon, dev

On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > 27/02/2019 11:50, Luca Boccassi:
> > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > > wrote:
> > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > 
> > > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > > tool
> > > > > > > which
> > > > > > > does the job of pkg-config. It was never compatible with
> > > > > > > cross
> > > > > > > compilation.
> > > > > > > Meson uses it when using dependency(), which then means
> > > > > > > cross
> > > > > > > compilation fails.
> > > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > > files
> > > > > > > so
> > > > > > > that Meson will not use it, and add a fallback in case
> > > > > > > dependency() fails.
> > > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > > will
> > > > > > > work out of the box in the future.
> > > > > > > 
> > > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > ---
> > > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > > 
> > > > > > I had some time to invest so I added back this change, in a
> > > > > > way
> > > > > > that
> > > > > > works with cross compilation too. Given the series wasn't
> > > > > > merged
> > > > > > yet
> > > > > > and there was a conflict I've done a v8 rather than a single
> > > > > > separate
> > > > > > patch, but it's independent from the rest.
> > > > > > 
> > > > > > More testing is of course welcome!
> > > > > 
> > > > > I still see the same error when cross-compiling:
> > > > > 
> > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > 
> > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > 
> > > > /Bruce
> > > 
> > > Yes please...
> > 
> > Yes, sure. I am checking other patches to push them.
> 
> Thanks!
> 
> > > Thomas, could you please give me detailed instructions on how to
> > > repro?
> > > I used the bootlin toolchain you linked me last time, and passed --
> > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > > everything
> > > built fine both with and without an arm64 build of libpcap in the
> > > sysroot. With the previous version that I removed it would fail.
> > > Not
> > > sure what I'm missing!
> > 
> > I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> 
> The script is working fine too - I have the toolchain in /tmp so I
> simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
> fine including the arm targets.
> 
> The key part in the patch was adding pcap-config = '' to the various
> arm configs, could you please double check that it was applied
> correctly? Without that, Meson finds and calls the native pcap-config
> which gives wrong (native) flags and causes the errors you are seeing.
> Otherwise I'm a bit lost, I can't understand why it's all working here
> and not there.
> 
> meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> The Meson build system
> Version: 0.49.2
> Source dir: /home/bluca/git/dpdk
> Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> Build type: cross build
> Project name: DPDK
> Project version: 19.05.0-rc0
> Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
> Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> Host machine cpu family: aarch64
> Host machine cpu: armv8-a
> Target machine cpu family: aarch64
> Target machine cpu: armv8-a
> <...>
> $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
> 

I'm testing on Fedora 29 and this patch works fine with the cross-builds
too. Maybe it's something special in Arch Linux again. I'll trying testing
it out in an Arch VM - though sadly Arch linux is failing to update for me,
so I won't have exactly Thomas' setup.

/Bruce

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-27 13:53                 ` Bruce Richardson
@ 2019-02-28 17:40                   ` Bruce Richardson
  2019-03-01 13:13                     ` Thomas Monjalon
  0 siblings, 1 reply; 88+ messages in thread
From: Bruce Richardson @ 2019-02-28 17:40 UTC (permalink / raw)
  To: Luca Boccassi, thomas; +Cc: Thomas Monjalon, dev

On Wed, Feb 27, 2019 at 01:53:32PM +0000, Bruce Richardson wrote:
> On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> > On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > > 27/02/2019 11:50, Luca Boccassi:
> > > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > > > wrote:
> > > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > 
> > > > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > > > tool
> > > > > > > > which
> > > > > > > > does the job of pkg-config. It was never compatible with
> > > > > > > > cross
> > > > > > > > compilation.
> > > > > > > > Meson uses it when using dependency(), which then means
> > > > > > > > cross
> > > > > > > > compilation fails.
> > > > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > > > files
> > > > > > > > so
> > > > > > > > that Meson will not use it, and add a fallback in case
> > > > > > > > dependency() fails.
> > > > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > > > will
> > > > > > > > work out of the box in the future.
> > > > > > > > 
> > > > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > ---
> > > > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > > > 
> > > > > > > I had some time to invest so I added back this change, in a
> > > > > > > way
> > > > > > > that
> > > > > > > works with cross compilation too. Given the series wasn't
> > > > > > > merged
> > > > > > > yet
> > > > > > > and there was a conflict I've done a v8 rather than a single
> > > > > > > separate
> > > > > > > patch, but it's independent from the rest.
> > > > > > > 
> > > > > > > More testing is of course welcome!
> > > > > > 
> > > > > > I still see the same error when cross-compiling:
> > > > > > 
> > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > 
> > > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > > 
> > > > > /Bruce
> > > > 
> > > > Yes please...
> > > 
> > > Yes, sure. I am checking other patches to push them.
> > 
> > Thanks!
> > 
> > > > Thomas, could you please give me detailed instructions on how to
> > > > repro?
> > > > I used the bootlin toolchain you linked me last time, and passed --
> > > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > > > everything
> > > > built fine both with and without an arm64 build of libpcap in the
> > > > sysroot. With the previous version that I removed it would fail.
> > > > Not
> > > > sure what I'm missing!
> > > 
> > > I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> > > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> > 
> > The script is working fine too - I have the toolchain in /tmp so I
> > simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
> > fine including the arm targets.
> > 
> > The key part in the patch was adding pcap-config = '' to the various
> > arm configs, could you please double check that it was applied
> > correctly? Without that, Meson finds and calls the native pcap-config
> > which gives wrong (native) flags and causes the errors you are seeing.
> > Otherwise I'm a bit lost, I can't understand why it's all working here
> > and not there.
> > 
> > meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> > The Meson build system
> > Version: 0.49.2
> > Source dir: /home/bluca/git/dpdk
> > Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> > Build type: cross build
> > Project name: DPDK
> > Project version: 19.05.0-rc0
> > Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
> > Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> > Host machine cpu family: aarch64
> > Host machine cpu: armv8-a
> > Target machine cpu family: aarch64
> > Target machine cpu: armv8-a
> > <...>
> > $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> > build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
> > 
> 
> I'm testing on Fedora 29 and this patch works fine with the cross-builds
> too. Maybe it's something special in Arch Linux again. I'll trying testing
> it out in an Arch VM - though sadly Arch linux is failing to update for me,
> so I won't have exactly Thomas' setup.
> 

I've also run this on Arch with the cross compiler installed and see no
issues. Thomas, can you look at the log below and see what differs from
your setup?

/Bruce

meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_thunderx_linuxapp_gcc /home/bruce/dpdk/devtools/.. build-arm64-thunderx
The Meson build system
Version: 0.49.2
Source dir: /home/bruce/dpdk
Build dir: /home/bruce/dpdk/build-arm64-thunderx
Build type: cross build
Project name: DPDK
Project version: 19.05.0-rc0
Native C compiler: gcc (gcc 8.2.1 "gcc (GCC) 8.2.1 20181127")
Cross C compiler: aarch64-linux-gnu-gcc (gcc 8.2.1)
Host machine cpu family: aarch64
Host machine cpu: armv8-a
Target machine cpu family: aarch64
Target machine cpu: armv8-a
Build machine cpu family: x86_64
Build machine cpu: x86_64
Checking for size of "void *" : 8
Library numa found: NO
Cross dependency libbsd found: NO (tried pkgconfig and cmake)
Compiler for C supports arguments -Wsign-compare: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wno-address-of-packed-member -Waddress-of-packed-member: NO
Message: Implementer : Cavium
Message: ['-march=armv8-a+crc+crypto', '-mcpu=thunderx']
Fetching value of define "__ARM_NEON" : 1
Fetching value of define "__ARM_FEATURE_CRC32" : 1
Fetching value of define "__ARM_FEATURE_CRYPTO" : 1
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Has header "linux/userfaultfd.h" : YES
Cross dependency libelf found: NO (tried pkgconfig and cmake)
Cross dependency jansson found: NO (tried pkgconfig and cmake)
Program gen-pmdinfo-cfile.sh found: YES (/home/bruce/dpdk/buildtools/gen-pmdinfo-cfile.sh)
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Library libmusdk found: NO
Compiler for C supports arguments -Wno-cast-qual -Wcast-qual: YES
Compiler for C supports arguments -Wno-pointer-to-int-cast -Wpointer-to-int-cast: YES
Cross dependency zlib found: NO (tried pkgconfig and cmake)
Compiler for C supports arguments -Wno-uninitialized -Wuninitialized: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-misleading-indentation -Wmisleading-indentation: YES
Compiler for C supports arguments -Wno-implicit-fallthrough -Wimplicit-fallthrough: YES
Compiler for C supports arguments -mavx2: NO
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-format-extra-args -Wformat-extra-args: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-missing-field-initializers -Wmissing-field-initializers: YES
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-format -Wformat: YES
Compiler for C supports arguments -Wno-error=format-security -Werror=format-security: NO
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Cross dependency libmnl found: NO (tried pkgconfig and cmake)
Cross dependency libmlx4 found: NO (tried pkgconfig and cmake)
Cross dependency libibverbs found: NO (tried pkgconfig and cmake)
Cross dependency libmnl found: NO (tried pkgconfig and cmake)
Cross dependency libmlx5 found: NO (tried pkgconfig and cmake)
Cross dependency libibverbs found: NO (tried pkgconfig and cmake)
Library libmusdk found: NO
Library libmusdk found: NO
Found pcap-config None NO
Cross dependency pcap found: NO (tried pkgconfig and config-tool)
Library pcap found: NO
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-missing-prototypes -Wmissing-prototypes: YES
Compiler for C supports arguments -Wno-cast-qual -Wcast-qual: YES
Compiler for C supports arguments -Wno-unused-function -Wunused-function: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-missing-prototypes -Wmissing-prototypes: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-format-nonliteral -Wformat-nonliteral: YES
Compiler for C supports arguments -Wno-shift-negative-value -Wshift-negative-value: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wno-missing-declarations -Wmissing-declarations: YES
Compiler for C supports arguments -Wno-maybe-uninitialized -Wmaybe-uninitialized: YES
Compiler for C supports arguments -Wno-strict-prototypes -Wstrict-prototypes: YES
Compiler for C supports arguments -Wno-shift-negative-value -Wshift-negative-value: YES
Compiler for C supports arguments -Wno-implicit-fallthrough -Wimplicit-fallthrough: YES
Compiler for C supports arguments -Wno-format-extra-args -Wformat-extra-args: YES
Compiler for C supports arguments -Wno-visibility -Wvisibility: NO
Compiler for C supports arguments -Wno-empty-body -Wempty-body: YES
Compiler for C supports arguments -Wno-invalid-source-encoding -Winvalid-source-encoding: NO
Compiler for C supports arguments -Wno-sometimes-uninitialized -Wsometimes-uninitialized: NO
Compiler for C supports arguments -Wno-pointer-bool-conversion -Wpointer-bool-conversion: NO
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wextra: YES
Compiler for C supports arguments -Wdisabled-optimization: YES
Compiler for C supports arguments -Waggregate-return: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wbad-function-cast: YES
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-empty-body -Wempty-body: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Library sze2 found: NO
Header <linux/pkt_cls.h> has symbol "TCA_FLOWER_UNSPEC" : YES
Header <linux/pkt_cls.h> has symbol "TCA_FLOWER_KEY_VLAN_PRIO" : YES
Header <linux/pkt_cls.h> has symbol "TCA_BPF_UNSPEC" : YES
Header <linux/pkt_cls.h> has symbol "TCA_BPF_FD" : YES
Header <linux/tc_act/tc_bpf.h> has symbol "TCA_ACT_BPF_UNSPEC" : YES
Header <linux/tc_act/tc_bpf.h> has symbol "TCA_ACT_BPF_FD" : YES
Configuring tap_autoconf.h using configuration
Compiler for C supports arguments -fno-prefetch-loop-arrays: YES
Compiler for C supports arguments -Wno-maybe-uninitialized -Wmaybe-uninitialized: YES
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wextra: YES
Compiler for C supports arguments -D_BSD_SOURCE: YES
Compiler for C supports arguments -D_DEFAULT_SOURCE: YES
Compiler for C supports arguments -D_XOPEN_SOURCE=600: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-format-extra-args -Wformat-extra-args: YES
Library IPSec_MB found: NO
Library IPSec_MB found: NO
Cross dependency libcrypto found: NO (tried pkgconfig and cmake)
Library libsso_kasumi found: NO
Library libmusdk found: NO
Cross dependency libcrypto found: NO (tried pkgconfig and cmake)
Cross dependency libcrypto found: NO (tried pkgconfig and cmake)
Library libsso_zuc found: NO
Cross dependency libisal found: NO (tried pkgconfig and cmake)
Cross dependency zlib found: NO (tried pkgconfig and cmake)
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-format -Wformat: YES
Compiler for C supports arguments -Wno-error=format-security -Werror=format-security: NO
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Library execinfo found: NO
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Cross dependency zlib found: NO (tried pkgconfig and cmake)
Library execinfo found: NO
Program doxygen found: NO
Program sphinx-build found: NO
Library execinfo found: NO
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Message: Skipping example "bpf"
Message: Skipping example "ethtool"
Has header "sys/epoll.h" : YES
Library pqos found: NO
Message: Skipping example "l2fwd-cat"
Library rt found: YES
Message: Skipping example "multi_process"
Message: Skipping example "netmap_compat"
Message: Skipping example "performance-thread"
Message: Skipping example "quota_watermark"
Message: Skipping example "server_node_efd"
Has header "virtio_scsi.h" : NO
Message: Skipping example "vhost_scsi"
Library virt found: NO
Cross dependency jansson found: NO (tried pkgconfig and cmake)
Message: Skipping example "vm_power_manager"
kernel/linux/meson.build:13: WARNING: Need "kernel_dir" option for kmod compilation when cross-compiling
Configuring rte_build_config.h using configuration
Program buildtools/symlink-drivers-solibs.sh found: YES (/bin/sh /home/bruce/dpdk/buildtools/symlink-drivers-solibs.sh)
Message: 
=================
Libraries Enabled
=================

libs:
	kvargs, eal, cmdline, ring, mempool, mbuf, net, meter, 
	ethdev, pci, metrics, hash, timer, acl, bbdev, bitratestats, 
	cfgfile, compressdev, cryptodev, distributor, efd, eventdev, gro, gso, 
	ip_frag, jobstats, kni, latencystats, lpm, member, power, pdump, 
	rawdev, reorder, sched, security, vhost, ipsec, port, table, 
	pipeline, flow_classify, bpf, 

Message: 
===============
Drivers Enabled
===============

common:
	cpt, dpaax, octeontx, 
bus:
	dpaa, fslmc, ifpga, pci, vdev, vmbus, 
mempool:
	bucket, dpaa, dpaa2, octeontx, ring, stack, 
net:
	af_packet, ark, atlantic, avf, avp, axgbe, bond, bnxt, 
	cxgbe, dpaa, dpaa2, e1000, ena, enetc, enic, failsafe, 
	fm10k, i40e, ice, ifc, ixgbe, kni, liquidio, netvsc, 
	nfp, null, octeontx, qede, ring, softnic, tap, thunderx, 
	vdev_netvsc, vhost, virtio, vmxnet3, 
crypto:
	caam_jr, dpaa_sec, dpaa2_sec, null_crypto, octeontx_crypto, crypto_scheduler, virtio_crypto, 
compress:
	octeontx_compress, qat, 
event:
	dpaa, dpaa2, octeontx, opdl, skeleton, sw, dsw, 
baseband:
	bbdev_null, 
raw:
	skeleton_rawdev, dpaa2_cmdif, dpaa2_qdma, ifpga_rawdev, 

Build targets in project: 437
Option default_library is: shared [default: static]
Found ninja-1.9.0 at /usr/bin/ninja
ninja -C build-arm64-thunderx
ninja: Entering directory `build-arm64-thunderx'
[1486/1486] Linking target examples/dpdk-load_balancer.
[0]
bruce@arch-vm:~/dpdk%

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-28 17:40                   ` Bruce Richardson
@ 2019-03-01 13:13                     ` Thomas Monjalon
  2019-03-01 15:13                       ` Luca Boccassi
  0 siblings, 1 reply; 88+ messages in thread
From: Thomas Monjalon @ 2019-03-01 13:13 UTC (permalink / raw)
  To: Bruce Richardson, Luca Boccassi; +Cc: dev

28/02/2019 18:40, Bruce Richardson:
> On Wed, Feb 27, 2019 at 01:53:32PM +0000, Bruce Richardson wrote:
> > On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> > > On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > > > 27/02/2019 11:50, Luca Boccassi:
> > > > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > > > > wrote:
> > > > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > > 
> > > > > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > > > > tool
> > > > > > > > > which
> > > > > > > > > does the job of pkg-config. It was never compatible with
> > > > > > > > > cross
> > > > > > > > > compilation.
> > > > > > > > > Meson uses it when using dependency(), which then means
> > > > > > > > > cross
> > > > > > > > > compilation fails.
> > > > > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > > > > files
> > > > > > > > > so
> > > > > > > > > that Meson will not use it, and add a fallback in case
> > > > > > > > > dependency() fails.
> > > > > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > > > > will
> > > > > > > > > work out of the box in the future.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > > ---
> > > > > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > > > > 
> > > > > > > > I had some time to invest so I added back this change, in a
> > > > > > > > way
> > > > > > > > that
> > > > > > > > works with cross compilation too. Given the series wasn't
> > > > > > > > merged
> > > > > > > > yet
> > > > > > > > and there was a conflict I've done a v8 rather than a single
> > > > > > > > separate
> > > > > > > > patch, but it's independent from the rest.
> > > > > > > > 
> > > > > > > > More testing is of course welcome!
> > > > > > > 
> > > > > > > I still see the same error when cross-compiling:
> > > > > > > 
> > > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > > 
> > > > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > > > 
> > > > > > /Bruce
> > > > > 
> > > > > Yes please...
> > > > 
> > > > Yes, sure. I am checking other patches to push them.
> > > 
> > > Thanks!
> > > 
> > > > > Thomas, could you please give me detailed instructions on how to
> > > > > repro?
> > > > > I used the bootlin toolchain you linked me last time, and passed --
> > > > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > > > > everything
> > > > > built fine both with and without an arm64 build of libpcap in the
> > > > > sysroot. With the previous version that I removed it would fail.
> > > > > Not
> > > > > sure what I'm missing!
> > > > 
> > > > I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> > > > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> > > 
> > > The script is working fine too - I have the toolchain in /tmp so I
> > > simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
> > > fine including the arm targets.
> > > 
> > > The key part in the patch was adding pcap-config = '' to the various
> > > arm configs, could you please double check that it was applied
> > > correctly? Without that, Meson finds and calls the native pcap-config
> > > which gives wrong (native) flags and causes the errors you are seeing.
> > > Otherwise I'm a bit lost, I can't understand why it's all working here
> > > and not there.
> > > 
> > > meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> > > The Meson build system
> > > Version: 0.49.2
> > > Source dir: /home/bluca/git/dpdk
> > > Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> > > Build type: cross build
> > > Project name: DPDK
> > > Project version: 19.05.0-rc0
> > > Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
> > > Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> > > Host machine cpu family: aarch64
> > > Host machine cpu: armv8-a
> > > Target machine cpu family: aarch64
> > > Target machine cpu: armv8-a
> > > <...>
> > > $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> > > build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
> > > 
> > 
> > I'm testing on Fedora 29 and this patch works fine with the cross-builds
> > too. Maybe it's something special in Arch Linux again. I'll trying testing
> > it out in an Arch VM - though sadly Arch linux is failing to update for me,
> > so I won't have exactly Thomas' setup.
> 
> I've also run this on Arch with the cross compiler installed and see no
> issues. Thomas, can you look at the log below and see what differs from
> your setup?

I'm sorry for the noise.
It compiles fine after cleaning the build directory :/

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-02-26 17:46   ` [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library luca.boccassi
  2019-02-26 17:49     ` Luca Boccassi
@ 2019-03-01 13:22     ` Thomas Monjalon
  1 sibling, 0 replies; 88+ messages in thread
From: Thomas Monjalon @ 2019-03-01 13:22 UTC (permalink / raw)
  To: luca.boccassi; +Cc: dev, bruce.richardson

26/02/2019 18:46, luca.boccassi@gmail.com:
> From: Luca Boccassi <luca.boccassi@microsoft.com>
> 
> pcap has historically shipped a custom pcap-config binary tool which
> does the job of pkg-config. It was never compatible with cross
> compilation.
> Meson uses it when using dependency(), which then means cross
> compilation fails.
> Set pcap-config to empty in the meson cross compilation files so
> that Meson will not use it, and add a fallback in case
> dependency() fails.
> libpcap 1.9.0 finally ships a pkg-config file so everything will
> work out of the box in the future.
> 
> Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> ---
> v8: added back pcap change separately. Tested with bootlin
>     cross-compilation toolchain, everything seems to work.

Applied separately of the rest, because I initially thought
there was an issue, but it appears to be a transient issue
solved by cleaning the build directory.
Thanks Luca.

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

* Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library
  2019-03-01 13:13                     ` Thomas Monjalon
@ 2019-03-01 15:13                       ` Luca Boccassi
  0 siblings, 0 replies; 88+ messages in thread
From: Luca Boccassi @ 2019-03-01 15:13 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson; +Cc: dev

On Fri, 2019-03-01 at 14:13 +0100, Thomas Monjalon wrote:
> 28/02/2019 18:40, Bruce Richardson:
> > On Wed, Feb 27, 2019 at 01:53:32PM +0000, Bruce Richardson wrote:
> > > On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> > > > On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > > > > 27/02/2019 11:50, Luca Boccassi:
> > > > > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon
> > > > > > > wrote:
> > > > > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > > > > On Tue, 2019-02-26 at 17:46 +0000, 
> > > > > > > > > luca.boccassi@gmail.com
> > > > > > > > > wrote:
> > > > > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > > > 
> > > > > > > > > > pcap has historically shipped a custom pcap-config
> > > > > > > > > > binary
> > > > > > > > > > tool
> > > > > > > > > > which
> > > > > > > > > > does the job of pkg-config. It was never compatible
> > > > > > > > > > with
> > > > > > > > > > cross
> > > > > > > > > > compilation.
> > > > > > > > > > Meson uses it when using dependency(), which then
> > > > > > > > > > means
> > > > > > > > > > cross
> > > > > > > > > > compilation fails.
> > > > > > > > > > Set pcap-config to empty in the meson cross
> > > > > > > > > > compilation
> > > > > > > > > > files
> > > > > > > > > > so
> > > > > > > > > > that Meson will not use it, and add a fallback in
> > > > > > > > > > case
> > > > > > > > > > dependency() fails.
> > > > > > > > > > libpcap 1.9.0 finally ships a pkg-config file so
> > > > > > > > > > everything
> > > > > > > > > > will
> > > > > > > > > > work out of the box in the future.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Luca Boccassi <
> > > > > > > > > > luca.boccassi@microsoft.com>
> > > > > > > > > > ---
> > > > > > > > > > v8: added back pcap change separately. Tested with
> > > > > > > > > > bootlin
> > > > > > > > > >     cross-compilation toolchain, everything seems
> > > > > > > > > > to work.
> > > > > > > > > 
> > > > > > > > > I had some time to invest so I added back this
> > > > > > > > > change, in a
> > > > > > > > > way
> > > > > > > > > that
> > > > > > > > > works with cross compilation too. Given the series
> > > > > > > > > wasn't
> > > > > > > > > merged
> > > > > > > > > yet
> > > > > > > > > and there was a conflict I've done a v8 rather than a
> > > > > > > > > single
> > > > > > > > > separate
> > > > > > > > > patch, but it's independent from the rest.
> > > > > > > > > 
> > > > > > > > > More testing is of course welcome!
> > > > > > > > 
> > > > > > > > I still see the same error when cross-compiling:
> > > > > > > > 
> > > > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > > > 
> > > > > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > > > > 
> > > > > > > /Bruce
> > > > > > 
> > > > > > Yes please...
> > > > > 
> > > > > Yes, sure. I am checking other patches to push them.
> > > > 
> > > > Thanks!
> > > > 
> > > > > > Thomas, could you please give me detailed instructions on
> > > > > > how to
> > > > > > repro?
> > > > > > I used the bootlin toolchain you linked me last time, and
> > > > > > passed --
> > > > > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson,
> > > > > > and
> > > > > > everything
> > > > > > built fine both with and without an arm64 build of libpcap
> > > > > > in the
> > > > > > sysroot. With the previous version that I removed it would
> > > > > > fail.
> > > > > > Not
> > > > > > sure what I'm missing!
> > > > > 
> > > > > I'm running devtools/test-meson-builds.sh on my ArchLinux
> > > > > which has
> > > > > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> > > > 
> > > > The script is working fine too - I have the toolchain in /tmp
> > > > so I
> > > > simply run it with PATH=/tmp/toolchain/bin:$PATH and everything
> > > > built
> > > > fine including the arm targets.
> > > > 
> > > > The key part in the patch was adding pcap-config = '' to the
> > > > various
> > > > arm configs, could you please double check that it was applied
> > > > correctly? Without that, Meson finds and calls the native pcap-
> > > > config
> > > > which gives wrong (native) flags and causes the errors you are
> > > > seeing.
> > > > Otherwise I'm a bit lost, I can't understand why it's all
> > > > working here
> > > > and not there.
> > > > 
> > > > meson --werror -Dexamples=all --default-library=shared --cross-
> > > > file config/arm/arm64_armv8_linuxapp_gcc
> > > > /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> > > > The Meson build system
> > > > Version: 0.49.2
> > > > Source dir: /home/bluca/git/dpdk
> > > > Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> > > > Build type: cross build
> > > > Project name: DPDK
> > > > Project version: 19.05.0-rc0
> > > > Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 
> > > > 8.2.0")
> > > > Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> > > > Host machine cpu family: aarch64
> > > > Host machine cpu: armv8-a
> > > > Target machine cpu family: aarch64
> > > > Target machine cpu: armv8-a
> > > > <...>
> > > > $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> > > > build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie
> > > > executable, ARM aarch64, version 1 (SYSV), dynamically linked,
> > > > not stripped
> > > > 
> > > 
> > > I'm testing on Fedora 29 and this patch works fine with the
> > > cross-builds
> > > too. Maybe it's something special in Arch Linux again. I'll
> > > trying testing
> > > it out in an Arch VM - though sadly Arch linux is failing to
> > > update for me,
> > > so I won't have exactly Thomas' setup.
> > 
> > I've also run this on Arch with the cross compiler installed and
> > see no
> > issues. Thomas, can you look at the log below and see what differs
> > from
> > your setup?
> 
> I'm sorry for the noise.
> It compiles fine after cleaning the build directory :/

No worries, thanks for checking again!

-- 
Kind regards,
Luca Boccassi

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

end of thread, other threads:[~2019-03-01 15:13 UTC | newest]

Thread overview: 88+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 17:57 [PATCH 1/2] build: use static deps of libs for pkg-config libs.private Luca Boccassi
2019-01-03 17:57 ` [PATCH 2/2] build: use dependency() instead of find_library() Luca Boccassi
2019-01-07 14:28   ` Bruce Richardson
2019-01-07 16:39     ` [dpdk-stable] " Luca Boccassi
2019-01-07 16:55       ` Bruce Richardson
2019-01-07 17:03         ` [dpdk-techboard] " Thomas Monjalon
2019-01-07 17:45           ` [dpdk-stable] [dpdk-techboard] " Thomas Monjalon
2019-01-07 21:09             ` Luca Boccassi
2019-01-07 22:03               ` Luca Boccassi
2019-01-11 11:10         ` [dpdk-stable] " Luca Boccassi
2019-01-11 11:52           ` Bruce Richardson
2019-01-11 12:39             ` Luca Boccassi
2019-01-11 14:24               ` Bruce Richardson
2019-01-11 14:56                 ` Luca Boccassi
2019-01-11 15:49                   ` Bruce Richardson
2019-01-11 16:27                     ` Luca Boccassi
2019-01-11 12:38 ` [PATCH v2 1/3] build: use static deps of libs for pkg-config libs.private Luca Boccassi
2019-01-11 12:38   ` [PATCH v2 2/3] build: use dependency() instead of find_library() Luca Boccassi
2019-01-11 12:38   ` [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd Luca Boccassi
2019-01-11 14:27     ` Bruce Richardson
2019-01-11 14:30       ` Bruce Richardson
2019-01-11 15:04         ` Luca Boccassi
2019-01-11 15:50           ` Bruce Richardson
2019-01-11 16:14             ` Luca Boccassi
2019-01-11 16:26 ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
2019-01-11 16:26   ` [PATCH v3 2/4] build: use dependency() instead of find_library() Luca Boccassi
2019-01-11 17:21     ` Bruce Richardson
2019-01-11 18:16       ` Luca Boccassi
2019-01-11 21:49         ` Bruce Richardson
2019-01-11 16:26   ` [PATCH v3 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
2019-01-11 17:22     ` Bruce Richardson
2019-01-11 16:26   ` [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
2019-01-11 17:24     ` Bruce Richardson
2019-01-11 17:17   ` [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1 Bruce Richardson
2019-01-11 18:22 ` [PATCH v4 " Luca Boccassi
2019-01-11 18:22   ` [PATCH v4 2/4] build: use dependency() instead of find_library() Luca Boccassi
2019-01-11 18:22   ` [PATCH v4 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
2019-01-11 18:22   ` [PATCH v4 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
2019-01-22 13:10 ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Luca Boccassi
2019-01-22 13:10   ` [PATCH v5 2/4] build: use dependency() instead of find_library() Luca Boccassi
2019-01-22 13:46     ` Bruce Richardson
2019-01-22 14:09       ` Luca Boccassi
2019-01-22 14:24         ` Bruce Richardson
2019-01-22 14:25     ` Bruce Richardson
2019-01-22 13:10   ` [PATCH v5 3/4] build: reorder libraries and build eal before cmdline Luca Boccassi
2019-01-22 13:10   ` [PATCH v5 4/4] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
2019-01-22 13:42   ` [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1 Bruce Richardson
2019-02-06 17:08 ` [PATCH v6 1/5] " Luca Boccassi
2019-02-06 17:08   ` [PATCH v6 2/5] build: use dependency() instead of find_library() Luca Boccassi
2019-02-12 11:15     ` Thomas Monjalon
2019-02-12 11:31       ` Bruce Richardson
2019-02-12 11:36         ` Thomas Monjalon
2019-02-12 11:43           ` Bruce Richardson
2019-02-12 14:47             ` Thomas Monjalon
2019-02-12 15:03               ` Bruce Richardson
2019-02-12 16:21                 ` Thomas Monjalon
2019-02-13 10:49                   ` Luca Boccassi
2019-02-13 11:10                     ` Thomas Monjalon
2019-02-13 13:45                       ` Luca Boccassi
2019-02-13 11:48                     ` Luca Boccassi
2019-02-06 17:08   ` [PATCH v6 3/5] build: reorder libraries and build eal before cmdline Luca Boccassi
2019-02-06 17:08   ` [PATCH v6 4/5] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
2019-02-06 17:08   ` [PATCH v6 5/5] build: use integers for numerical options Luca Boccassi
2019-02-08 14:44     ` Bruce Richardson
2019-02-13 11:54 ` [PATCH v7 1/5] build: bump minimum Meson version to 0.47.1 Luca Boccassi
2019-02-13 11:54   ` [PATCH v7 2/5] build: use dependency() instead of find_library() Luca Boccassi
2019-02-13 15:35     ` Bruce Richardson
2019-02-13 11:54   ` [PATCH v7 3/5] build: reorder libraries and build eal before cmdline Luca Boccassi
2019-02-13 11:54   ` [PATCH v7 4/5] build: use dependency() for libbsd instead of manual append to ldflags Luca Boccassi
2019-02-13 11:54   ` [PATCH v7 5/5] build: use integers for numerical options Luca Boccassi
2019-02-26 17:46 ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 luca.boccassi
2019-02-26 17:46   ` [PATCH v8 2/6] build: use dependency() instead of find_library() luca.boccassi
2019-02-26 17:46   ` [PATCH v8 3/6] build: reorder libraries and build eal before cmdline luca.boccassi
2019-02-26 17:46   ` [PATCH v8 4/6] build: use dependency() for libbsd instead of manual append to ldflags luca.boccassi
2019-02-26 17:46   ` [PATCH v8 5/6] build: use integers for numerical options luca.boccassi
2019-02-26 17:46   ` [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library luca.boccassi
2019-02-26 17:49     ` Luca Boccassi
2019-02-27  8:33       ` Thomas Monjalon
2019-02-27  9:47         ` Bruce Richardson
2019-02-27 10:50           ` Luca Boccassi
2019-02-27 10:56             ` Thomas Monjalon
2019-02-27 12:03               ` Luca Boccassi
2019-02-27 13:53                 ` Bruce Richardson
2019-02-28 17:40                   ` Bruce Richardson
2019-03-01 13:13                     ` Thomas Monjalon
2019-03-01 15:13                       ` Luca Boccassi
2019-03-01 13:22     ` Thomas Monjalon
2019-02-27 11:29   ` [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1 Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.