Skip to contentSkip to conversation

build: use static deps of libs for pkg-config libs.private

PATCH Superseded Luca Boccassi 4 participants 88 messages Jan 3, 2019 – Mar 1, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 build: use static deps of libs for pkg-config libs.private

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")
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 7cee3c94a..617e88589 100644
@@ -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'), '.'],
Signature · 1 line
2.19.2
#1 lore raw

PATCH 2/2 build: use dependency() instead of find_library()

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")

---

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(-)
app/meson.build +1 -1
index 47a2a8615..e31386f1a 100644
@@ -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)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index c2a0dd8ba..80e5e8835 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +2 -2
index c3c66bbc0..f442f9719 100644
@@ -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
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 7de571e2a..4ba4e93b6 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 28938db0f..7ff3660fa 100644
@@ -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
drivers/net/pcap/meson.build +2 -3
index 0c4e0201a..89c9d7a74 100644
@@ -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'
examples/meson.build +1 -1
index af81c762e..881e2da33 100644
@@ -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)
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
lib/meson.build +1 -1
index a2dd52e17..b2a18f488 100644
@@ -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')
meson.build +1 -1
index 617e88589..f87dc235f 100644
@@ -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.
test/test/meson.build +1 -0
index 5a4816fed..886c29fb4 100644
@@ -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'
Signature · 1 line
2.19.2
#2 lore raw

Re: [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 10 lines · 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.

Quoted 3 lines

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.

Quoted 8 lines

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.

Quoted 5 lines
Fixes a25a650be5f0 ("build: add infrastructure for meson and ninja builds")
Quoted 8 lines

---

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

Quoted 1 line
#3 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 20 lines · Bruce Richardson
Quoted 14 lines · 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.

Quoted 4 lines

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.

Quoted 6 lines

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.

Quoted 12 lines
Quoted 11 lines

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.

Quoted 3 lines

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

Quoted 8 lines

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.

Quoted 5 lines

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.

Quoted 19 lines
Quoted 8 lines
Fixes a25a650be5f0 ("build: add infrastructure for meson and ninja

builds")
Cc: [email protected]

---

Quoted 10 lines

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.

Quoted 5 lines

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

/Bruce

Ok.

Signature · 2 lines
Kind regards,
Luca Boccassi
#4 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 39 lines · Luca Boccassi
Quoted 20 lines · Bruce Richardson
Quoted 14 lines · 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.

Quoted 4 lines

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.

Quoted 6 lines

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

Quoted 6 lines

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.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

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.

Quoted 6 lines
Quoted 3 lines

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].

Quoted 13 lines

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

Quoted 8 lines

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.

Quoted 9 lines
Quoted 5 lines

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

#5 lore raw

Re: [dpdk-techboard] [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

07/01/2019 17:55, Bruce Richardson:

Quoted 29 lines · Luca Boccassi
Quoted 9 lines · Bruce Richardson
Quoted 8 lines

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.

Quoted 9 lines
Quoted 5 lines

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]

Quoted 5 lines

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?

#6 lore raw

Re: [dpdk-stable] [dpdk-techboard] [PATCH 2/2] build: use dependency() instead of find_library()

07/01/2019 18:03, Thomas Monjalon:

Quoted 30 lines

07/01/2019 17:55, Bruce Richardson:

Quoted 29 lines · Luca Boccassi
Quoted 9 lines · Bruce Richardson
Quoted 8 lines

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.

Quoted 9 lines
Quoted 5 lines

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]

Quoted 7 lines
Quoted 5 lines

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.

#7 lore raw

Re: [dpdk-stable] [dpdk-techboard] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 51 lines · Thomas Monjalon

07/01/2019 18:03, Thomas Monjalon:

Quoted 50 lines

07/01/2019 17:55, Bruce Richardson:

Quoted 48 lines · Luca Boccassi
Quoted 20 lines · Bruce Richardson
Quoted 11 lines

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.

Quoted 7 lines

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.

Quoted 4 lines

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.

Quoted 8 lines
Quoted 2 lines

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

Signature · 2 lines
Kind regards,
Luca Boccassi
#8 lore raw

Re: [dpdk-stable] [dpdk-techboard] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 66 lines · Luca Boccassi
Quoted 53 lines · Thomas Monjalon

07/01/2019 18:03, Thomas Monjalon:

Quoted 52 lines

07/01/2019 17:55, Bruce Richardson:

Quoted 50 lines · Luca Boccassi
Quoted 20 lines · Bruce Richardson
Quoted 11 lines

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.

Quoted 7 lines

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.

Quoted 4 lines

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.

Quoted 8 lines
Quoted 2 lines

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:

Quoted 8 lines

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#9 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

In reply to Bruce Richardson
Quoted 25 lines · Bruce Richardson
Quoted 17 lines · Luca Boccassi
Quoted 16 lines · Bruce Richardson
Quoted 14 lines · Luca Boccassi

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.

Quoted 6 lines
Quoted 3 lines

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?

Quoted 7 lines

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?

Signature · 2 lines
Kind regards,
Luca Boccassi
#10 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 34 lines · Luca Boccassi
Quoted 25 lines · Bruce Richardson
Quoted 17 lines · Luca Boccassi
Quoted 16 lines · Bruce Richardson
Quoted 14 lines · Luca Boccassi

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.

Quoted 6 lines
Quoted 3 lines

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?

Quoted 7 lines

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].

Quoted 8 lines

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

#11 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 57 lines · Bruce Richardson
Quoted 48 lines · Luca Boccassi
Quoted 33 lines · Bruce Richardson
Quoted 23 lines · Luca Boccassi
Quoted 22 lines · Bruce Richardson
Quoted 19 lines · Luca Boccassi

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.

Quoted 8 lines
Quoted 4 lines

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?

Quoted 10 lines

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:

Quoted 7 lines

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?

Quoted 6 lines

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#12 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 63 lines · Luca Boccassi
Quoted 62 lines · Bruce Richardson
Quoted 48 lines · Luca Boccassi
Quoted 33 lines · Bruce Richardson
Quoted 23 lines · Luca Boccassi
Quoted 22 lines · Bruce Richardson
Quoted 19 lines · Luca Boccassi

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.

Quoted 8 lines
Quoted 4 lines

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?

Quoted 10 lines

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:

Quoted 7 lines

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.

Quoted 7 lines
Quoted 1 line

/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?

#13 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 85 lines · Bruce Richardson
Quoted 84 lines · Luca Boccassi
Quoted 68 lines · Bruce Richardson
Quoted 58 lines · Luca Boccassi
Quoted 40 lines · Bruce Richardson
Quoted 33 lines · Luca Boccassi
Quoted 26 lines · Bruce Richardson
Quoted 15 lines · Luca Boccassi

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

Quoted 8 lines

it
would
diverge from the legacy Makefile's behaviour and make life
a
bit
more
difficult for contributors.

Quoted 5 lines

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.

Quoted 4 lines

Won't that mean that the shared libraries other than EAL will
have
undefined references?

Quoted 12 lines

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:

Quoted 8 lines

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?

Quoted 8 lines

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.

Quoted 3 lines
Quoted 1 line

--

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

Signature · 2 lines
Kind regards,
Luca Boccassi
#14 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 86 lines · Luca Boccassi
Quoted 85 lines · Bruce Richardson
Quoted 84 lines · Luca Boccassi
Quoted 68 lines · Bruce Richardson
Quoted 58 lines · Luca Boccassi
Quoted 40 lines · Bruce Richardson
Quoted 33 lines · Luca Boccassi
Quoted 26 lines · Bruce Richardson
Quoted 15 lines · Luca Boccassi

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

Quoted 8 lines

it
would
diverge from the legacy Makefile's behaviour and make life
a
bit
more
difficult for contributors.

Quoted 5 lines

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.

Quoted 4 lines

Won't that mean that the shared libraries other than EAL will
have
undefined references?

Quoted 12 lines

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:

Quoted 8 lines

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?

Quoted 8 lines

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.

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

--

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

#15 lore raw

Re: [dpdk-stable] [PATCH 2/2] build: use dependency() instead of find_library()

Quoted 117 lines · Bruce Richardson
Quoted 116 lines · Luca Boccassi
Quoted 107 lines · Bruce Richardson
Quoted 106 lines · Luca Boccassi
Quoted 96 lines · Bruce Richardson
Quoted 80 lines · Luca Boccassi
Quoted 58 lines · Bruce Richardson
Quoted 41 lines · Luca Boccassi
Quoted 31 lines · Bruce Richardson
Quoted 19 lines · Luca Boccassi

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

Quoted 8 lines

would
diverge from the legacy Makefile's behaviour and
make
life
a
bit
more
difficult for contributors.

Quoted 7 lines

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.

Quoted 5 lines

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

Quoted 8 lines

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'

Quoted 4 lines

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.

Quoted 1 line

/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.

Quoted 3 lines
Quoted 1 line

--

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

Quoted 7 lines
Quoted 1 line

--

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#16 lore raw

PATCH v2 1/3 build: use static deps of libs for pkg-config libs.private

In reply to Luca Boccassi

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")
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 426e0bf3a..d500507c5 100644
@@ -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.
Signature · 1 line
2.20.1
#17 lore raw

PATCH v2 2/3 build: use dependency() instead of find_library()

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.

---
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(-)
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index c2a0dd8ba..80e5e8835 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +1 -1
index c3c66bbc0..91bc6dc3f 100644
@@ -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
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 7de571e2a..4ba4e93b6 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 8ba19e818..161c5641f 100644
@@ -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
drivers/net/pcap/meson.build +2 -3
index 0c4e0201a..89c9d7a74 100644
@@ -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'
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
meson.build +1 -1
index d500507c5..35126106a 100644
@@ -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.
Signature · 1 line
2.20.1
#18 lore raw

PATCH v2 3/3 build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

In reply to 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.

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_cmdline/meson.build +4 -0
index 30498906c..be286d4a2 100644
@@ -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',
lib/librte_eal/meson.build +3 -0
index a18f3a826..fa60736c9 100644
@@ -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
meson.build +1 -1
index 35126106a..4041eccb6 100644
@@ -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.
Signature · 1 line
2.20.1
#19 lore raw

Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

Quoted 11 lines · 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.

---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
libbsd dependency to eal and cmdline

Quoted 6 lines
 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')
#20 lore raw

Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

Quoted 21 lines · Bruce Richardson
Quoted 11 lines · 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.

---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
libbsd dependency to eal and cmdline

Quoted 6 lines
 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:

Quoted 7 lines
$ 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

#21 lore raw

Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

Quoted 38 lines · Bruce Richardson
Quoted 26 lines · Bruce Richardson
Quoted 14 lines · 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.

---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
    libbsd dependency to eal and cmdline

Quoted 6 lines

 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:

Quoted 10 lines
$ 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')
Quoted 7 lines

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 :-)

Signature · 2 lines
Kind regards,
Luca Boccassi
#22 lore raw

Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

Quoted 45 lines · Luca Boccassi
Quoted 44 lines · Bruce Richardson
Quoted 26 lines · Bruce Richardson
Quoted 14 lines · 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.

---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
    libbsd dependency to eal and cmdline

Quoted 6 lines

 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:

Quoted 10 lines
$ 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.

Quoted 10 lines
Quoted 1 line

/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 :-)

Signature · 2 lines
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

#23 lore raw

Re: [PATCH v2 3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

Quoted 65 lines · Bruce Richardson
Quoted 60 lines · Luca Boccassi
Quoted 43 lines · Bruce Richardson
Quoted 31 lines · Bruce Richardson
Quoted 18 lines · 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.

---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and
move
    libbsd dependency to eal and cmdline

Quoted 6 lines

 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:

Quoted 10 lines
$ 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')
Quoted 8 lines

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 :-)

Quoted 3 lines

--
Kind regards,
Luca Boccassi

Quoted 6 lines

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#24 lore raw

PATCH v3 1/4 build: bump minimum Meson version to 0.47.1

In reply to 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.

---
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(-)
drivers/meson.build +1 -4
index c3c66bbc0..e37d4fe2b 100644
@@ -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
kernel/linux/meson.build +1 -5
index 5b7ec06e1..d751d939f 100644
@@ -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
meson.build +15 -20
index d500507c5..d0534dc0d 100644
@@ -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')
Signature · 1 line
2.20.1
#25 lore raw

PATCH v3 2/4 build: use dependency() instead of find_library()

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.

---
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(-)
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index c2a0dd8ba..80e5e8835 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +1 -1
index e37d4fe2b..d17ca76eb 100644
@@ -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
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 7de571e2a..4ba4e93b6 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 8ba19e818..161c5641f 100644
@@ -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
drivers/net/pcap/meson.build +2 -3
index 0c4e0201a..89c9d7a74 100644
@@ -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'
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
Signature · 1 line
2.20.1
#26 lore raw

Re: [PATCH v3 2/4] build: use dependency() instead of find_library()

Quoted 7 lines · 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

Spelling: superfluous

Quoted 54 lines

take extra time, and avoid adding the linker flag manually which causes it to be duplicated.

---
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(-)
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index c2a0dd8ba..80e5e8835 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +0 -0
index e37d4fe2b..d17ca76eb 100644

drivers/meson.build foreach class:driver_classes · line 52

Quoted 8 lines
drivers/meson.build +1 -1
@@ -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

#27 lore raw

Re: [PATCH v3 2/4] build: use dependency() instead of find_library()

Quoted 12 lines · Bruce Richardson
Quoted 10 lines · 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

Quoted 1 line

Spelling: superfluous

I _always_ get that one wrong :-)

Quoted 74 lines
Quoted 66 lines

take extra time, and avoid adding the linker flag manually which causes
it to be duplicated.

---
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(-)
drivers/crypto/ccp/meson.build +0 -0
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
  		'ccp_pmd_ops.c')


 ext_deps += dep

drivers/crypto/ccp/meson.build +0 -1
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -0
index c2a0dd8ba..80e5e8835 100644
@@ -8,4 +8,3 @@ endif

 deps += 'bus_vdev'
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c') ext_deps += dep

drivers/crypto/openssl/meson.build +0 -1
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/qat/meson.build +0 -0
index 9cc98d2c2..21f969735 100644
@@ -13,6 +13,5 @@ if dep.found()
  			     'qat_sym.c',
  			     'qat_sym_session.c')

  qat_ext_deps += dep

drivers/crypto/qat/meson.build +0 -1
-	pkgconfig_extra_libs += '-lcrypto'

  qat_cflags += '-DBUILD_QAT_SYM'
 endif

drivers/meson.build +0 -0
index e37d4fe2b..d17ca76eb 100644
@@ -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

drivers/meson.build +0 -1
-		# using dependency() or cc.find_library(). For

most cases, we

drivers/meson.build +1 -0
+		# using dependency() (preferred) or

find_library(). For most cases, we

Quoted 4 lines
 		# 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.

Quoted 4 lines

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#28 lore raw

Re: [PATCH v3 2/4] build: use dependency() instead of find_library()

Quoted 13 lines · Luca Boccassi
Quoted 12 lines · Bruce Richardson
Quoted 10 lines · 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

Quoted 4 lines
Quoted 1 line

Spelling: superfluous

I _always_ get that one wrong :-)

I often spell it as "unnecessary" to make life easier :-)

#29 lore raw

PATCH v3 3/4 build: reorder libraries and build eal before cmdline

In reply to 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.

---
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(-)
lib/meson.build +3 -2
index a2dd52e17..bf8417c6d 100644
@@ -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
Signature · 1 line
2.20.1
Acked-by on v3 3/4
#30 lore raw

Re: [PATCH v3 3/4] build: reorder libraries and build eal before cmdline

Quoted 19 lines · 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.

---
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(-)
lib/meson.build +0 -0
index a2dd52e17..bf8417c6d 100644
@@ -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.

lib/meson.build line 18

Quoted 10 lines
lib/meson.build +3 -2
 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

#31 lore raw

PATCH v3 4/4 build: use dependency() for libbsd instead of manual append to ldflags

In reply to Luca Boccassi

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

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_eal/meson.build +3 -0
index a18f3a826..fa60736c9 100644
@@ -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
Signature · 1 line
2.20.1
Acked-by on v3 4/4
#32 lore raw

Re: [PATCH v3 4/4] build: use dependency() for libbsd instead of manual append to ldflags

Quoted 11 lines · Luca Boccassi

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

---
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 on v3 1/4
#33 lore raw

Re: [PATCH v3 1/4] build: bump minimum Meson version to 0.47.1

In reply to Luca Boccassi
Quoted 6 lines · 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.

Quoted 9 lines

---
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.

#34 lore raw

PATCH v4 1/4 build: bump minimum Meson version to 0.47.1

In reply to 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.

---
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(-)
drivers/meson.build +1 -4
index c3c66bbc0..e37d4fe2b 100644
@@ -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
kernel/linux/meson.build +1 -5
index 5b7ec06e1..d751d939f 100644
@@ -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
meson.build +15 -20
index d500507c5..d0534dc0d 100644
@@ -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')
Signature · 1 line
2.20.1
#35 lore raw

PATCH v4 2/4 build: use dependency() instead of find_library()

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.

---
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(-)
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index c2a0dd8ba..80e5e8835 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +5 -4
index e37d4fe2b..69d0556d3 100644
@@ -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 = []
 
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 7de571e2a..4ba4e93b6 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 8ba19e818..161c5641f 100644
@@ -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
drivers/net/pcap/meson.build +2 -3
index 0c4e0201a..89c9d7a74 100644
@@ -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'
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
Signature · 1 line
2.20.1
#36 lore raw

PATCH v4 3/4 build: reorder libraries and build eal before cmdline

In reply to 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.

---
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(-)
lib/meson.build +3 -2
index a2dd52e17..bf8417c6d 100644
@@ -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
Signature · 1 line
2.20.1
#37 lore raw

PATCH v4 4/4 build: use dependency() for libbsd instead of manual append to ldflags

In reply to Luca Boccassi

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

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_eal/meson.build +3 -0
index a18f3a826..fa60736c9 100644
@@ -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
Signature · 1 line
2.20.1
#38 lore raw

PATCH v5 1/4 build: bump minimum Meson version to 0.47.1

In reply to 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.

---
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(-)
drivers/meson.build +1 -4
index c3c66bbc0..e37d4fe2b 100644
@@ -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
kernel/linux/meson.build +1 -5
index 5b7ec06e1..d751d939f 100644
@@ -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
meson.build +15 -20
index 68429f850..bef38ac37 100644
@@ -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')
Signature · 1 line
2.20.1
#39 lore raw

PATCH v5 2/4 build: use dependency() instead of find_library()

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.

---
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(-)
drivers/compress/zlib/meson.build +0 -1
index 7748de2df..b036703c7 100644
@@ -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
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index 77a6596d7..d56a32366 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +5 -4
index e37d4fe2b..69d0556d3 100644
@@ -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 = []
 
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 4bccd68e0..b4f9672e7 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 4540c455b..0cf2f0873 100644
@@ -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
drivers/net/pcap/meson.build +2 -3
index 0c4e0201a..89c9d7a74 100644
@@ -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'
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
Signature · 1 line
2.20.1
#40 lore raw

Re: [PATCH v5 2/4] build: use dependency() instead of find_library()

Quoted 10 lines · 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.

Quoted 7 lines

---
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

#41 lore raw

Re: [PATCH v5 2/4] build: use dependency() instead of find_library()

Quoted 24 lines · Bruce Richardson
Quoted 15 lines · 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.

Quoted 7 lines

---
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

Quoted 7 lines

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).

Signature · 2 lines
Kind regards,
Luca Boccassi
#42 lore raw

Re: [PATCH v5 2/4] build: use dependency() instead of find_library()

Quoted 31 lines · Luca Boccassi
Quoted 30 lines · Bruce Richardson
Quoted 15 lines · 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.

Quoted 7 lines

---
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?

Quoted 8 lines
Quoted 1 line

/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

Acked-by on v5 2/4
#43 lore raw

Re: [PATCH v5 2/4] build: use dependency() instead of find_library()

In reply to Luca Boccassi
Quoted 10 lines · 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.

Quoted 8 lines

---
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.

#44 lore raw

PATCH v5 3/4 build: reorder libraries and build eal before cmdline

In reply to 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.

---
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(-)
lib/meson.build +3 -2
index e8b40f546..074a8b8b4 100644
@@ -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
Signature · 1 line
2.20.1
#45 lore raw

PATCH v5 4/4 build: use dependency() for libbsd instead of manual append to ldflags

In reply to Luca Boccassi

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

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_eal/meson.build +3 -0
index a18f3a826..fa60736c9 100644
@@ -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
Signature · 1 line
2.20.1
Acked-by on v5 1/4
#46 lore raw

Re: [PATCH v5 1/4] build: bump minimum Meson version to 0.47.1

In reply to Luca Boccassi
Quoted 11 lines · 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.

---
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

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

LGTM

#47 lore raw

PATCH v6 1/5 build: bump minimum Meson version to 0.47.1

In reply to 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.

---
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(-)
drivers/meson.build +1 -4
index c3c66bbc0..e37d4fe2b 100644
@@ -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
kernel/linux/meson.build +1 -5
index 5b7ec06e1..d751d939f 100644
@@ -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
meson.build +15 -20
index 7f5e8674b..e9793b127 100644
@@ -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')
Signature · 1 line
2.20.1
#48 lore raw

PATCH v6 2/5 build: use dependency() instead of find_library()

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.

---
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(-)
drivers/compress/zlib/meson.build +0 -1
index 7748de2df..b036703c7 100644
@@ -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
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index 77a6596d7..d56a32366 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +5 -4
index e37d4fe2b..69d0556d3 100644
@@ -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 = []
 
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 4bccd68e0..b4f9672e7 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 4540c455b..0cf2f0873 100644
@@ -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
drivers/net/pcap/meson.build +2 -3
index 0c4e0201a..89c9d7a74 100644
@@ -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'
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
Signature · 1 line
2.20.1
#49 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines

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

#50 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

Quoted 14 lines · Thomas Monjalon

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines
Quoted 9 lines

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

#51 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

12/02/2019 12:31, Bruce Richardson:

Quoted 24 lines · Thomas Monjalon
Quoted 14 lines

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines
Quoted 9 lines

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

Quoted 5 lines

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.

#52 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

Quoted 25 lines · Thomas Monjalon

12/02/2019 12:31, Bruce Richardson:

Quoted 24 lines · Thomas Monjalon
Quoted 23 lines

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines

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

Quoted 9 lines
Quoted 5 lines

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

#53 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

12/02/2019 12:43, Bruce Richardson:

Quoted 30 lines · Thomas Monjalon
Quoted 29 lines

12/02/2019 12:31, Bruce Richardson:

Quoted 28 lines · Thomas Monjalon
Quoted 14 lines

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines
Quoted 9 lines

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)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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?

#54 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

Quoted 43 lines · Thomas Monjalon

12/02/2019 12:43, Bruce Richardson:

Quoted 30 lines · Thomas Monjalon
Quoted 29 lines

12/02/2019 12:31, Bruce Richardson:

Quoted 28 lines · Thomas Monjalon
Quoted 14 lines

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines
Quoted 9 lines

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)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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.

Quoted 8 lines

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

#55 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

12/02/2019 16:03, Bruce Richardson:

Quoted 52 lines · Thomas Monjalon
Quoted 43 lines

12/02/2019 12:43, Bruce Richardson:

Quoted 30 lines · Thomas Monjalon
Quoted 29 lines

12/02/2019 12:31, Bruce Richardson:

Quoted 28 lines · Thomas Monjalon
Quoted 14 lines

06/02/2019 18:08, Luca Boccassi:

Quoted 10 lines

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.

Quoted 2 lines
Quoted 9 lines

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)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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.

Quoted 8 lines

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?

Quoted 6 lines

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?

#56 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

Quoted 79 lines · Thomas Monjalon

12/02/2019 16:03, Bruce Richardson:

Quoted 78 lines · Thomas Monjalon
Quoted 61 lines

12/02/2019 12:43, Bruce Richardson:

Quoted 51 lines
Quoted 43 lines · Thomas Monjalon

12/02/2019 12:31, Bruce Richardson:

Quoted 42 lines
Quoted 24 lines · Thomas Monjalon

06/02/2019 18:08, Luca Boccassi:

Quoted 17 lines

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.

Quoted 2 lines

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

Quoted 9 lines

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)

Quoted 5 lines
Quoted 1 line

Anything unusual about your setup?

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

Quoted 5 lines

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.

Quoted 9 lines

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].

Quoted 7 lines
Quoted 2 lines

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

Signature · 2 lines
Kind regards,
Luca Boccassi
#57 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

13/02/2019 11:49, Luca Boccassi:

Quoted 11 lines · Thomas Monjalon
Quoted 1 line

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/

#58 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

Quoted 10 lines · Thomas Monjalon

13/02/2019 11:49, Luca Boccassi:

Quoted 9 lines · Thomas Monjalon
Quoted 1 line

Luca, please could you test cross-compilation?

Hi,

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

Quoted 7 lines
Quoted 5 lines

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#59 lore raw

Re: [PATCH v6 2/5] build: use dependency() instead of find_library()

In reply to Luca Boccassi
Quoted 98 lines · Luca Boccassi
Quoted 86 lines · Thomas Monjalon

12/02/2019 16:03, Bruce Richardson:

Quoted 85 lines · Thomas Monjalon
Quoted 67 lines

12/02/2019 12:43, Bruce Richardson:

Quoted 56 lines
Quoted 48 lines · Thomas Monjalon

12/02/2019 12:31, Bruce Richardson:

Quoted 47 lines
Quoted 29 lines · Thomas Monjalon

06/02/2019 18:08, Luca Boccassi:

Quoted 18 lines

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.

Quoted 3 lines

m>

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

from drivers/net/pcap/rte_eth_pcap.c

Quoted 8 lines

/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)

Quoted 5 lines
Quoted 1 line

Anything unusual about your setup?

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

Quoted 6 lines

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.

Quoted 9 lines

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].

Quoted 8 lines
Quoted 3 lines

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,

Quoted 8 lines

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.

Signature · 2 lines
Kind regards,
Luca Boccassi
#60 lore raw

PATCH v6 3/5 build: reorder libraries and build eal before cmdline

In reply to 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.

---
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(-)
lib/meson.build +3 -2
index e8b40f546..074a8b8b4 100644
@@ -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
Signature · 1 line
2.20.1
#61 lore raw

PATCH v6 4/5 build: use dependency() for libbsd instead of manual append to ldflags

In reply to Luca Boccassi

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

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_eal/meson.build +3 -0
index a18f3a826..fa60736c9 100644
@@ -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
Signature · 1 line
2.20.1
#62 lore raw

PATCH v6 5/5 build: use integers for numerical options

In reply to Luca Boccassi

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

---
v6: added following Bruce's suggestion

 meson_options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meson_options.txt +2 -2
index 574054597..4e178178f 100644
@@ -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')
Signature · 1 line
2.20.1
#64 lore raw

PATCH v7 1/5 build: bump minimum Meson version to 0.47.1

In reply to 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.

---
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(-)
drivers/meson.build +1 -4
index c3c66bbc0..e37d4fe2b 100644
@@ -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
kernel/linux/meson.build +1 -5
index 5b7ec06e1..d751d939f 100644
@@ -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
meson.build +15 -20
index 7f5e8674b..e9793b127 100644
@@ -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')
Signature · 1 line
2.20.1
#65 lore raw

PATCH v7 2/5 build: use dependency() instead of find_library()

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.

---
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(-)
drivers/compress/zlib/meson.build +0 -1
index 7748de2df..b036703c7 100644
@@ -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
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index 77a6596d7..d56a32366 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +5 -4
index e37d4fe2b..69d0556d3 100644
@@ -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 = []
 
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 4bccd68e0..b4f9672e7 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 4540c455b..0cf2f0873 100644
@@ -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
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
Signature · 1 line
2.20.1
Tested-by on v7 2/5
#66 lore raw

Re: [PATCH v7 2/5] build: use dependency() instead of find_library()

Quoted 12 lines · 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.

Quoted 9 lines

---
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.

#67 lore raw

PATCH v7 3/5 build: reorder libraries and build eal before cmdline

In reply to 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.

---
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(-)
lib/meson.build +3 -2
index e8b40f546..074a8b8b4 100644
@@ -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
Signature · 1 line
2.20.1
#68 lore raw

PATCH v7 4/5 build: use dependency() for libbsd instead of manual append to ldflags

In reply to Luca Boccassi

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

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_eal/meson.build +3 -0
index a18f3a826..fa60736c9 100644
@@ -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
Signature · 1 line
2.20.1
#69 lore raw

PATCH v7 5/5 build: use integers for numerical options

In reply to Luca Boccassi

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

---
v6: added following Bruce's suggestion
v7: add acked-by

 meson_options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meson_options.txt +2 -2
index 574054597..4e178178f 100644
@@ -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')
Signature · 1 line
2.20.1
#70 lore raw

PATCH v8 1/6 build: bump minimum Meson version to 0.47.1

In reply to Luca Boccassi

From: Luca Boccassi <[email protected]>

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.

---
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(-)
drivers/meson.build +1 -4
index c3c66bbc0..e37d4fe2b 100644
@@ -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
kernel/linux/meson.build +1 -5
index 5b7ec06e1..d751d939f 100644
@@ -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
meson.build +15 -20
index 2bbd42bc8..69833de82 100644
@@ -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')
Signature · 1 line
2.20.1
#71 lore raw

PATCH v8 2/6 build: use dependency() instead of find_library()

From: Luca Boccassi <[email protected]>

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.

---
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(-)
drivers/compress/zlib/meson.build +0 -1
index 7748de2df..b036703c7 100644
@@ -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
drivers/crypto/ccp/meson.build +0 -1
index e43b00591..915c4c854 100644
@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c',
 		'ccp_pmd_ops.c')
 
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
drivers/crypto/openssl/meson.build +0 -1
index 77a6596d7..d56a32366 100644
@@ -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'
drivers/crypto/qat/meson.build +0 -1
index 9cc98d2c2..21f969735 100644
@@ -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
drivers/meson.build +5 -4
index e37d4fe2b..69d0556d3 100644
@@ -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 = []
 
drivers/net/bnx2x/meson.build +1 -1
index e3c688869..dd189ffc4 100644
@@ -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'
drivers/net/mlx4/meson.build +3 -3
index 4bccd68e0..b4f9672e7 100644
@@ -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
drivers/net/mlx5/meson.build +3 -3
index 4540c455b..0cf2f0873 100644
@@ -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
lib/librte_bpf/meson.build +2 -2
index bc0cd78f9..c3b1f698e 100644
@@ -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
lib/librte_telemetry/meson.build +1 -1
index 9492f544e..cafb26f08 100644
@@ -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']
Signature · 1 line
2.20.1
#72 lore raw

PATCH v8 3/6 build: reorder libraries and build eal before cmdline

In reply to [email protected]

From: Luca Boccassi <[email protected]>

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.

---
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(-)
lib/meson.build +3 -2
index edcccdcb6..99957ba7d 100644
@@ -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
Signature · 1 line
2.20.1
#73 lore raw

PATCH v8 4/6 build: use dependency() for libbsd instead of manual append to ldflags

In reply to [email protected]

From: Luca Boccassi <[email protected]>

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

---
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(-)
config/meson.build +5 -5
index db32499b3..e1af468ee 100644
@@ -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
lib/librte_eal/meson.build +3 -0
index 64d857a4a..98c1d1f31 100644
@@ -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
Signature · 1 line
2.20.1
#74 lore raw

PATCH v8 5/6 build: use integers for numerical options

In reply to [email protected]

From: Luca Boccassi <[email protected]>

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

---
v6: added following Bruce's suggestion
v7: add acked-by

 meson_options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meson_options.txt +2 -2
index 574054597..4e178178f 100644
@@ -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')
Signature · 1 line
2.20.1
#75 lore raw

PATCH v8 6/6 build: use dependency for pcap and fallback to find_library

In reply to [email protected]

From: Luca Boccassi <[email protected]>

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.

---
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(-)
config/arm/arm64_armv8_linuxapp_gcc +1 -0
index 987c02fbb..513760917 100644
@@ -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'
config/arm/arm64_dpaa2_linuxapp_gcc +1 -0
index 7ec74ec4b..0df8c8f7d 100644
@@ -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'
config/arm/arm64_dpaa_linuxapp_gcc +1 -0
index 73a8f0b81..f4b85a84b 100644
@@ -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'
config/arm/arm64_thunderx_linuxapp_gcc +1 -0
index 967d9d46d..14b801998 100644
@@ -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'
drivers/net/pcap/meson.build +12 -4
index 0c4e0201a..2c2fd11e4 100644
@@ -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'
Signature · 1 line
2.20.1
#76 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 13 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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!

Signature · 2 lines
Kind regards,
Luca Boccassi
#77 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

26/02/2019 18:49, Luca Boccassi:

Quoted 19 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:
Quoted 13 lines

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
v8: added back pcap change separately. Tested with bootlin
cross-compilation toolchain, everything seems to work.

Quoted 6 lines

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

#78 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 25 lines · Thomas Monjalon

26/02/2019 18:49, Luca Boccassi:

Quoted 24 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:
Quoted 13 lines

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

Quoted 6 lines
Quoted 1 line

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

#79 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 34 lines · Bruce Richardson
Quoted 33 lines · Thomas Monjalon

26/02/2019 18:49, Luca Boccassi:

Quoted 31 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:
Quoted 16 lines

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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!

Quoted 7 lines
Quoted 4 lines

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!

Signature · 2 lines
Kind regards,
Luca Boccassi
#80 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

27/02/2019 11:50, Luca Boccassi:

Quoted 37 lines · Bruce Richardson
Quoted 36 lines · Thomas Monjalon
Quoted 35 lines

26/02/2019 18:49, Luca Boccassi:

Quoted 30 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:
Quoted 16 lines

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

Quoted 1 line

More testing is of course welcome!

I still see the same error when cross-compiling:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

/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.

Quoted 6 lines

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.

#81 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 47 lines · Thomas Monjalon

27/02/2019 11:50, Luca Boccassi:

Quoted 46 lines · Bruce Richardson
Quoted 45 lines · Thomas Monjalon
Quoted 44 lines

26/02/2019 18:49, Luca Boccassi:

Quoted 37 lines
Quoted 20 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

Quoted 1 line

More testing is of course welcome!

I still see the same error when cross-compiling:

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

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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!

Quoted 10 lines
Quoted 9 lines

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!

Quoted 2 lines

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
Signature · 2 lines
Kind regards,
Luca Boccassi
#82 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 97 lines · Luca Boccassi
Quoted 47 lines · Thomas Monjalon

27/02/2019 11:50, Luca Boccassi:

Quoted 46 lines · Bruce Richardson
Quoted 45 lines · Thomas Monjalon
Quoted 44 lines

26/02/2019 18:49, Luca Boccassi:

Quoted 37 lines
Quoted 20 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

Quoted 1 line

More testing is of course welcome!

I still see the same error when cross-compiling:

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

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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!

Quoted 10 lines
Quoted 9 lines

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!

Quoted 2 lines

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
<...>

Quoted 3 lines
$ 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

#83 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 102 lines · Bruce Richardson
Quoted 97 lines · Luca Boccassi
Quoted 47 lines · Thomas Monjalon

27/02/2019 11:50, Luca Boccassi:

Quoted 46 lines · Bruce Richardson
Quoted 45 lines · Thomas Monjalon
Quoted 44 lines

26/02/2019 18:49, Luca Boccassi:

Quoted 37 lines
Quoted 20 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

Quoted 1 line

More testing is of course welcome!

I still see the same error when cross-compiling:

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

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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!

Quoted 10 lines
Quoted 9 lines

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!

Quoted 2 lines

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
<...>

Quoted 3 lines
$ 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
Quoted 5 lines

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%

#84 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

28/02/2019 18:40, Bruce Richardson:

Quoted 103 lines · Bruce Richardson
Quoted 102 lines · Luca Boccassi
Quoted 100 lines · Thomas Monjalon
Quoted 47 lines

27/02/2019 11:50, Luca Boccassi:

Quoted 46 lines · Bruce Richardson
Quoted 45 lines · Thomas Monjalon
Quoted 44 lines

26/02/2019 18:49, Luca Boccassi:

Quoted 37 lines
Quoted 20 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

Quoted 1 line

More testing is of course welcome!

I still see the same error when cross-compiling:

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

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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!

Quoted 10 lines
Quoted 9 lines

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!

Quoted 2 lines

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
Quoted 8 lines
Quoted 4 lines

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 :/

#85 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

Quoted 143 lines · Thomas Monjalon

28/02/2019 18:40, Bruce Richardson:

Quoted 142 lines · Bruce Richardson
Quoted 140 lines · Luca Boccassi
Quoted 126 lines · Thomas Monjalon
Quoted 61 lines

27/02/2019 11:50, Luca Boccassi:

Quoted 60 lines · Bruce Richardson
Quoted 59 lines
Quoted 57 lines · Thomas Monjalon

26/02/2019 18:49, Luca Boccassi:

Quoted 50 lines
Quoted 26 lines · On Tue, 2019-02-26 at 17:46 +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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.

Quoted 7 lines

Signed-off-by: Luca Boccassi < [email protected]>
---
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.

Quoted 1 line

More testing is of course welcome!

I still see the same error when cross-compiling:

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

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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!

Quoted 15 lines
Quoted 6 lines

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,

Quoted 8 lines

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!

Quoted 3 lines

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
<...>

Quoted 5 lines
$ 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.

Quoted 8 lines
Quoted 5 lines

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!

Signature · 2 lines
Kind regards,
Luca Boccassi
#86 lore raw

Re: [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library

In reply to [email protected]

26/02/2019 18:46, [email protected]:

Quoted 13 lines

From: Luca Boccassi <[email protected]>

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.

Quoted 4 lines

---
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.

#87 lore raw

Re: [PATCH v8 1/6] build: bump minimum Meson version to 0.47.1

In reply to [email protected]

26/02/2019 18:46, [email protected]:

Quoted 9 lines

From: Luca Boccassi <[email protected]>

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.

Series applied without the last patch, thanks.