[PATCH 2/2] build: prevent accidentally building without NUMA support

Bruce Richardson bruce.richardson at intel.com
Mon Jun 12 18:21:04 CEST 2023


When libnuma development package is missing on a system, DPDK can still
be built but will be missing much-needed support for NUMA memory
management. This may later cause issues at runtime if the resulting
binary is run on a NUMA system.

We can reduce the incidence of such runtime error by ensuring that, for
native builds*, libnuma is present - unless the user actually specifies
via "max_numa_nodes" that they don't require NUMA support. Having this
as an error condition is also in keeping with what is documented in the
Linux GSG doc, where libnuma is listed as a requirement for building
DPDK [1].

* NOTE: cross-compilation builds have a different logic set, with a
  separate "numa" value indicating if numa support is necessary.

[1] https://doc.dpdk.org/guides-23.03/linux_gsg/sys_reqs.html

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 config/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/config/meson.build b/config/meson.build
index 8aebccbbdc..bffd3600c6 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -381,6 +381,12 @@ endif
 if not dpdk_conf.has('RTE_MAX_NUMA_NODES')
     error('Number of NUMA nodes not specified.')
 endif
+if not meson.is_cross_build() and dpdk_conf.get('RTE_MAX_NUMA_NODES') > 1 and not has_libnuma
+    error('''
+No NUMA library (development package) found, yet DPDK configured for multiple NUMA nodes.
+Please install libnuma, or set 'max_numa_nodes' option to '1' to build without NUMA support.
+''')
+endif
 
 # set the install path for the drivers
 dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
-- 
2.39.2



More information about the dev mailing list