Skip to contentSkip to conversation

enable easier app compilation testing with meson

PATCH In review Bruce Richardson 3 participants 10 messages Mar 29, 2018 – Apr 9, 2018

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

cover enable easier app compilation testing with meson

Summary:
With this set you can test building all applicable examples by calling meson with "-Dexamples=all"

When building DPDK with meson, it's possible to specify a list of sample apps to have built along with the main code. However, specifying a full list of all apps can be unwieldy, so this set adds support for passing "all" as the examples to be built.

With "all", meson just adds all subdirectories of "examples" to the build, so the first few patches are ensuring that we don't get an error by attempting to build an unsupported application. On linux, only 7 apps were unsupported, in that they had not been given a meson.build file. On FreeBSD, a few others had to have their meson.build files updated to report them as unsupported.

In terms of behaviour, the meson.build file for each app will report if the app can be built or not. If "all" is requested, then a message is printed and the meson run can continue. If, however, the app is requested by name, then an error is reported and the meson run halts.

The final two patches in the series are more cleanup, the former improves error reporting, while the last patch is a performance improvement. Meson runs quickly enough in the normal case, but with a full set of examples, the dependency chain resolution can slow things down. Reducing the lists of dependencies makes a noticable difference in this case. [NOTE: this slowness and speedup only applies to the meson run; the actual build using ninja is as fast as ever!]

Bruce Richardson (6):
examples: add empty meson files for unsupported examples examples/l2fwd-cat: make build dependent on pqos library
examples: disable unsupported examples on BSD
examples: allow building all examples as part of meson build
examples: improve error report for missing meson deps drivers/dpaa*: reduce meson dependency lists

 drivers/bus/dpaa/meson.build            |  2 +-
 drivers/bus/fslmc/meson.build           |  2 +-
 drivers/crypto/dpaa2_sec/meson.build    |  2 +-
 drivers/event/dpaa/meson.build          |  2 +-
 drivers/event/dpaa2/meson.build         |  2 +-
 drivers/mempool/dpaa2/meson.build       |  2 +-
 drivers/net/dpaa/meson.build            |  2 +-
 drivers/net/dpaa2/meson.build           |  2 +-
 examples/ethtool/meson.build            | 10 +++++++
 examples/kni/meson.build                |  3 +++
 examples/l2fwd-cat/meson.build          |  4 ++-
 examples/l3fwd-power/meson.build        |  3 +++
 examples/meson.build                    | 48 ++++++++++++++++++++++++---------
 examples/multi_process/meson.build      | 10 +++++++
 examples/netmap_compat/meson.build      | 10 +++++++
 examples/performance-thread/meson.build | 10 +++++++
 examples/quota_watermark/meson.build    | 10 +++++++
 examples/server_node_efd/meson.build    | 10 +++++++
 examples/tep_termination/meson.build    |  3 +++
 examples/vhost/meson.build              |  3 +++
 examples/vhost_scsi/meson.build         |  3 +++
 examples/vm_power_manager/meson.build   | 10 +++++++
 22 files changed, 131 insertions(+), 22 deletions(-)
 create mode 100644 examples/ethtool/meson.build
 create mode 100644 examples/multi_process/meson.build
 create mode 100644 examples/netmap_compat/meson.build
 create mode 100644 examples/performance-thread/meson.build
 create mode 100644 examples/quota_watermark/meson.build
 create mode 100644 examples/server_node_efd/meson.build
 create mode 100644 examples/vm_power_manager/meson.build
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/6 examples: add empty meson files for unsupported examples

---
 examples/ethtool/meson.build            | 10 ++++++++++
 examples/multi_process/meson.build      | 10 ++++++++++
 examples/netmap_compat/meson.build      | 10 ++++++++++
 examples/performance-thread/meson.build | 10 ++++++++++
 examples/quota_watermark/meson.build    | 10 ++++++++++
 examples/server_node_efd/meson.build    | 10 ++++++++++
 examples/vm_power_manager/meson.build   | 10 ++++++++++
 7 files changed, 70 insertions(+)
 create mode 100644 examples/ethtool/meson.build
 create mode 100644 examples/multi_process/meson.build
 create mode 100644 examples/netmap_compat/meson.build
 create mode 100644 examples/performance-thread/meson.build
 create mode 100644 examples/quota_watermark/meson.build
 create mode 100644 examples/server_node_efd/meson.build
 create mode 100644 examples/vm_power_manager/meson.build
examples/ethtool/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
examples/multi_process/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
examples/netmap_compat/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
examples/performance-thread/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
examples/quota_watermark/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
examples/server_node_efd/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
examples/vm_power_manager/meson.build new file +10 -0
new file mode 100644
index 000000000..c370d7476
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+# Example app currently unsupported by meson build
+build = false
Signature · 1 line
2.14.3
#2 lore raw

PATCH 2/6 examples/l2fwd-cat: make build dependent on pqos library

In reply to Bruce Richardson

The l2fwd-cat example uses the pqos library to work, so make the meson build dependent on the presence of that library

---
 examples/l2fwd-cat/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/l2fwd-cat/meson.build +3 -1
index b6deabc97..1234e7b55 100644
@@ -6,7 +6,9 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-ext_deps += cc.find_library('pqos')
+pqos = cc.find_library('pqos', required: false)
+build = pqos.found()
+ext_deps += pqos
 cflags += '-D_GNU_SOURCE'
 cflags += '-I/usr/local/include' # assume pqos lib installed in /usr/local
 sources = files(
Signature · 1 line
2.14.3
#3 lore raw

PATCH 3/6 examples: disable unsupported examples on BSD

In reply to Bruce Richardson
---
 examples/kni/meson.build             | 3 +++
 examples/l3fwd-power/meson.build     | 3 +++
 examples/tep_termination/meson.build | 3 +++
 examples/vhost/meson.build           | 3 +++
 examples/vhost_scsi/meson.build      | 3 +++
 5 files changed, 15 insertions(+)
examples/kni/meson.build +3 -0
index c39aead6f..0443ab99b 100644
@@ -6,6 +6,9 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+if host_machine.system() != 'linux'
+	build = false
+endif
 deps += ['kni', 'bus_pci']
 sources = files(
 	'main.c'
examples/l3fwd-power/meson.build +3 -0
index 61e8daa96..f633a0f17 100644
@@ -6,6 +6,9 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+if host_machine.system() != 'linux'
+	build = false
+endif
 deps += ['power', 'timer', 'lpm', 'hash']
 sources = files(
 	'main.c'
examples/tep_termination/meson.build +3 -0
index 68c940aab..618a44a67 100644
@@ -6,6 +6,9 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+if host_machine.system() != 'linux'
+	build = false
+endif
 deps += ['hash', 'vhost']
 sources = files(
 	'main.c', 'vxlan.c', 'vxlan_setup.c'
examples/vhost/meson.build +3 -0
index 3e6e69047..853ecae7c 100644
@@ -6,6 +6,9 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+if host_machine.system() != 'linux'
+	build = false
+endif
 deps += 'vhost'
 sources = files(
 	'main.c', 'virtio_net.c'
examples/vhost_scsi/meson.build +3 -0
index bd78e84b3..5f92370f5 100644
@@ -6,6 +6,9 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+if host_machine.system() != 'linux'
+	build = false
+endif
 deps += 'vhost'
 cflags += ['-D_GNU_SOURCE','-D_FILE_OFFSET_BITS=64']
 sources = files(
Signature · 1 line
2.14.3
#4 lore raw

PATCH 4/6 examples: allow building all examples as part of meson build

In reply to Bruce Richardson

To test building all relevant example applications as part of a build, we add support for the "all" keyword to be passed to the "examples" build option. Since not all examples can actually be built on all systems, we also add support for the "build" option inside the sub-dirs. However, in case where "all" is not used, and a particular example is requested to be built, we will error out if building the requested app is not possible.

---
 examples/meson.build | 45 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 32 insertions(+), 13 deletions(-)
examples/meson.build +32 -13
index 2c6b3f889..16c3ab005 100644
@@ -7,8 +7,20 @@ if get_option('default_library') == 'static'
 endif
 
 execinfo = cc.find_library('execinfo', required: false)
-foreach example: get_option('examples').split(',')
+
+allow_skips = true # don't flag an error if we can't build an app
+
+if get_option('examples').to_lower() == 'all'
+	dirs = run_command('sh', '-c',
+		'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done')
+	examples = dirs.stdout().split()
+else
+	examples = get_option('examples').split(',')
+	allow_skips = false # error out if we can't build a requested app
+endif
+foreach example: examples
 	name = example
+	build = true
 	sources = []
 	allow_experimental_apis = false
 	cflags = machine_args
@@ -17,17 +29,24 @@ foreach example: get_option('examples').split(',')
 	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
 	subdir(example)
 
-	dep_objs = ext_deps
-	foreach d:deps
-		dep_objs += [get_variable(get_option('default_library') + '_rte_' + d)]
-	endforeach
-	if allow_experimental_apis
-		cflags += '-DALLOW_EXPERIMENTAL_API'
+	if build
+		dep_objs = ext_deps
+		foreach d:deps
+			dep_objs += [get_variable(
+				get_option('default_library') + '_rte_' + d)]
+		endforeach
+		if allow_experimental_apis
+			cflags += '-DALLOW_EXPERIMENTAL_API'
+		endif
+		executable('dpdk-' + name, sources,
+			include_directories: includes,
+			link_whole: driver_libs,
+			link_args: dpdk_extra_ldflags,
+			c_args: cflags,
+			dependencies: dep_objs)
+	elif not allow_skips
+		error('Cannot build requested example "' + name + '"')
+	else
+		message('Skipping example "' + name + '"')
 	endif
-	executable('dpdk-' + name, sources,
-		include_directories: includes,
-		link_whole: driver_libs,
-		link_args: dpdk_extra_ldflags,
-		c_args: cflags,
-		dependencies: dep_objs)
 endforeach
Signature · 1 line
2.14.3
#5 lore raw

PATCH 5/6 examples: improve error report for missing meson deps

In reply to Bruce Richardson

When a required library is missing on a platform, rather than having meson report an error about the missing variable, catch the problem earlier and provide a more readable message.

---
 examples/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
examples/meson.build +5 -2
index 16c3ab005..3d1568497 100644
@@ -32,8 +32,11 @@ foreach example: examples
 	if build
 		dep_objs = ext_deps
 		foreach d:deps
-			dep_objs += [get_variable(
-				get_option('default_library') + '_rte_' + d)]
+			var_name = get_option('default_library') + '_rte_' + d
+			if not is_variable(var_name)
+				error('Missing dependency "@0@" for example "@1@"'.format(d, name))
+			endif
+			dep_objs += [get_variable(var_name)]
 		endforeach
 		if allow_experimental_apis
 			cflags += '-DALLOW_EXPERIMENTAL_API'
Signature · 1 line
2.14.3
#6 lore raw

PATCH 6/6 drivers/dpaa*: reduce meson dependency lists

In reply to Bruce Richardson

Meson build currently tracks the dependencies between libraries, which can often make things easier, but has the side-effect of slowing down the initial meson run if too many duplicated dependencies are provided. Therefore, we remove dependencies from the dpaa items where other dependencies already depend on those. This provides a noticable speed-up in meson configuration runs when lots of sample apps are included in the build.

---
 drivers/bus/dpaa/meson.build         | 2 +-
 drivers/bus/fslmc/meson.build        | 2 +-
 drivers/crypto/dpaa2_sec/meson.build | 2 +-
 drivers/event/dpaa/meson.build       | 2 +-
 drivers/event/dpaa2/meson.build      | 2 +-
 drivers/mempool/dpaa2/meson.build    | 2 +-
 drivers/net/dpaa/meson.build         | 2 +-
 drivers/net/dpaa2/meson.build        | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
drivers/bus/dpaa/meson.build +1 -1
index f5c6d7bb6..d10b62c03 100644
@@ -5,7 +5,7 @@ if host_machine.system() != 'linux'
         build = false
 endif
 
-deps += ['ethdev', 'eventdev']
+deps += ['eventdev']
 sources = files('base/fman/fman.c',
 		'base/fman/fman_hw.c',
 		'base/fman/netcfg_layer.c',
drivers/bus/fslmc/meson.build +1 -1
index e94340eae..d743f710b 100644
@@ -5,7 +5,7 @@ if host_machine.system() != 'linux'
         build = false
 endif
 
-deps += ['ethdev', 'eventdev', 'kvargs']
+deps += ['eventdev', 'kvargs']
 sources = files('fslmc_bus.c',
 		'fslmc_vfio.c',
 		'mc/dpbp.c',
drivers/crypto/dpaa2_sec/meson.build +1 -1
index 0fb4d961e..01afc5877 100644
@@ -5,7 +5,7 @@ if host_machine.system() != 'linux'
         build = false
 endif
 
-deps += ['bus_fslmc', 'security', 'mempool_dpaa2']
+deps += ['security', 'mempool_dpaa2']
 sources = files('dpaa2_sec_dpseci.c',
 		'mc/dpseci.c')
 
drivers/event/dpaa/meson.build +1 -1
index 9bbd6c2a1..0914f858e 100644
@@ -4,7 +4,7 @@
 if host_machine.system() != 'linux'
 	build = false
 endif
-deps += ['mempool_dpaa', 'bus_dpaa', 'pmd_dpaa']
+deps += ['pmd_dpaa']
 sources = files('dpaa_eventdev.c')
 
 allow_experimental_apis = true
drivers/event/dpaa2/meson.build +1 -1
index 835460c5d..de7a46155 100644
@@ -4,7 +4,7 @@
 if host_machine.system() != 'linux'
 	build = false
 endif
-deps += ['mempool_dpaa2', 'bus_fslmc', 'bus_vdev', 'pmd_dpaa2']
+deps += ['bus_vdev', 'pmd_dpaa2']
 sources = files('dpaa2_hw_dpcon.c',
 		'dpaa2_eventdev.c')
 
drivers/mempool/dpaa2/meson.build +1 -1
index dee3a88ab..08e753060 100644
@@ -5,5 +5,5 @@ if host_machine.system() != 'linux'
         build = false
 endif
 
-deps += ['mbuf', 'bus_fslmc']
+deps += ['bus_fslmc']
 sources = files('dpaa2_hw_mempool.c')
drivers/net/dpaa/meson.build +1 -1
index a4c40a680..62dec7b04 100644
@@ -4,7 +4,7 @@
 if host_machine.system() != 'linux'
 	build = false
 endif
-deps += ['bus_dpaa', 'mempool_dpaa']
+deps += ['mempool_dpaa']
 
 sources = files('dpaa_ethdev.c',
 		'dpaa_rxtx.c')
drivers/net/dpaa2/meson.build +1 -1
index ad1724d44..c9bd97a69 100644
@@ -5,7 +5,7 @@ if host_machine.system() != 'linux'
         build = false
 endif
 
-deps += ['bus_fslmc', 'mempool_dpaa2']
+deps += ['mempool_dpaa2']
 sources = files('base/dpaa2_hw_dpni.c',
 		'dpaa2_ethdev.c',
 		'dpaa2_rxtx.c',
Signature · 1 line
2.14.3
#8 lore raw
In reply to Bruce Richardson
Quoted 37 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, March 29, 2018 2:55 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH 0/6] enable easier app compilation testing with meson

Summary:
With this set you can test building all applicable examples by calling meson with "-Dexamples=all"

When building DPDK with meson, it's possible to specify a list of sample apps to have built along with the main code. However, specifying a full list of all apps can be unwieldy, so this set adds support for passing "all" as the examples to be built.

With "all", meson just adds all subdirectories of "examples" to the build, so the first few patches are ensuring that we don't get an error by attempting to build an unsupported application. On linux, only 7 apps were unsupported, in that they had not been given a meson.build file. On FreeBSD, a few others had to have their meson.build files updated to report them as unsupported.

In terms of behaviour, the meson.build file for each app will report if the app can be built or not. If "all" is requested, then a message is printed and the meson run can continue. If, however, the app is requested by name, then an error is reported and the meson run halts.

The final two patches in the series are more cleanup, the former improves error reporting, while the last patch is a performance improvement. Meson runs quickly enough in the normal case, but with a full set of examples, the dependency chain resolution can slow things down. Reducing the lists of dependencies makes a noticable difference in this case. [NOTE: this slowness and speedup only applies to the meson run; the actual build using ninja is as fast as ever!]

Quoted 7 lines

Bruce Richardson (6):
examples: add empty meson files for unsupported examples examples/l2fwd-cat: make build dependent on pqos library
examples: disable unsupported examples on BSD
examples: allow building all examples as part of meson build
examples: improve error report for missing meson deps drivers/dpaa*: reduce meson dependency lists

Working fine for me here!

#9 lore raw
Quoted 45 lines · Harry
Quoted 37 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, March 29, 2018 2:55 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH 0/6] enable easier app compilation testing with meson

Summary:
With this set you can test building all applicable examples by calling meson with "-Dexamples=all"

When building DPDK with meson, it's possible to specify a list of sample apps to have built along with the main code. However, specifying a full list of all apps can be unwieldy, so this set adds support for passing "all" as the examples to be built.

With "all", meson just adds all subdirectories of "examples" to the build, so the first few patches are ensuring that we don't get an error by attempting to build an unsupported application. On linux, only 7 apps were unsupported, in that they had not been given a meson.build file. On FreeBSD, a few others had to have their meson.build files updated to report them as unsupported.

In terms of behaviour, the meson.build file for each app will report if the app can be built or not. If "all" is requested, then a message is printed and the meson run can continue. If, however, the app is requested by name, then an error is reported and the meson run halts.

The final two patches in the series are more cleanup, the former improves error reporting, while the last patch is a performance improvement. Meson runs quickly enough in the normal case, but with a full set of examples, the dependency chain resolution can slow things down. Reducing the lists of dependencies makes a noticable difference in this case. [NOTE: this slowness and speedup only applies to the meson run; the actual build using ninja is as fast as ever!]

Quoted 7 lines

Bruce Richardson (6):
examples: add empty meson files for unsupported examples examples/l2fwd-cat: make build dependent on pqos library
examples: disable unsupported examples on BSD
examples: allow building all examples as part of meson build
examples: improve error report for missing meson deps drivers/dpaa*: reduce meson dependency lists

Quoted 4 lines

Working fine for me here!

Series applied to dpdk-next-build.

Quoted 1 line

From testing, there appears to be an issue with building ip_pipeline sample

app for a generic armv8 platform, but not for the thunderx one. Ideally, if someone from the arm community can help fix this in the C code , it would be great, otherwise I'll try and do up a patch to selectively disable ip_pipeline for platforms where it can't compile.

/Bruce