* [dpdk-dev] [PATCH v2 1/3] build: fix kernel compile on cross-build
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Bruce Richardson
@ 2018-04-27 13:49 ` Bruce Richardson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 2/3] build: fix check for libbsd in meson Bruce Richardson
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: Bruce Richardson @ 2018-04-27 13:49 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, bluca, Bruce Richardson
When cross-compiling, if no kernel_dir was specified, then the kernel
modules were still being compiled for the build machine. Fix this by
only building modules on cross-compile when we have a kernel_dir value
set. Print out a message indicating why we are skipping kernel
compilation, and in case that the headers for kernel compile are not
found, print a warning instead of erroring out.
Fixes: a52f4574f798 ("igb_uio: build with meson")
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
kernel/linux/igb_uio/meson.build | 6 ------
kernel/linux/meson.build | 40 +++++++++++++++++++++++++++++++++++++---
meson.build | 6 +++++-
3 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/kernel/linux/igb_uio/meson.build b/kernel/linux/igb_uio/meson.build
index 356f4ab32..71ed2e7a8 100644
--- a/kernel/linux/igb_uio/meson.build
+++ b/kernel/linux/igb_uio/meson.build
@@ -1,12 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
-kernel_dir = get_option('kernel_dir')
-if kernel_dir == ''
- kernel_version = run_command('uname', '-r').stdout().strip()
- kernel_dir = '/lib/modules/' + kernel_version + '/build'
-endif
-
mkfile = custom_target('igb_uio_makefile',
output: 'Makefile',
command: ['touch', '@OUTPUT@'])
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index a5b88f0c6..a924c7b6f 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -3,6 +3,40 @@
subdirs = ['igb_uio']
-foreach d:subdirs
- subdir(d)
-endforeach
+WARN_CROSS_COMPILE='Need "kernel_dir" option for kmod compilation when cross-compiling'
+WARN_NO_HEADERS='Cannot compile kernel modules as requested - are kernel headers installed?'
+
+# if we are cross-compiling we need kernel_dir specified
+# NOTE: warning() function only available from version 0.44 onwards
+if get_option('kernel_dir') == '' and meson.is_cross_build()
+ if meson.version().version_compare('>=0.44')
+ warning(WARN_CROSS_COMPILE)
+ else
+ message('WARNING: ' + WARN_CROSS_COMPILE)
+ endif
+else
+
+ kernel_dir = get_option('kernel_dir')
+ if kernel_dir == ''
+ # use default path for native builds
+ kernel_version = run_command('uname', '-r').stdout().strip()
+ kernel_dir = '/lib/modules/' + kernel_version + '/build'
+ endif
+
+ # test running make in kernel directory, using "make kernelversion"
+ 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
+ else # returncode == 0
+
+# DO ACTUAL MODULE BUILDING
+ foreach d:subdirs
+ subdir(d)
+ endforeach
+ endif
+endif
diff --git a/meson.build b/meson.build
index cc16595cb..52a8746c5 100644
--- a/meson.build
+++ b/meson.build
@@ -26,7 +26,6 @@ subdir('config')
# build libs and drivers
subdir('lib')
-subdir('kernel')
subdir('buildtools')
subdir('drivers')
@@ -40,6 +39,11 @@ if get_option('examples') != ''
subdir('examples')
endif
+# build kernel modules if enabled
+if get_option('enable_kmods')
+ subdir('kernel')
+endif
+
# write the build config
build_cfg = 'rte_build_config.h'
configure_file(output: build_cfg,
--
2.14.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 2/3] build: fix check for libbsd in meson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Bruce Richardson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 1/3] build: fix kernel compile on cross-build Bruce Richardson
@ 2018-04-27 13:49 ` Bruce Richardson
2018-04-27 13:51 ` Bruce Richardson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 3/3] build: ensure compatibility with future meson versions Bruce Richardson
2018-04-27 14:37 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Luca Boccassi
3 siblings, 1 reply; 14+ messages in thread
From: Bruce Richardson @ 2018-04-27 13:49 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, bluca, Bruce Richardson
When we check for libbsd we were just checking for the library itself.
However, on some distros, e.g. CentOS, libbsd will be found even though
it's not usable by DPDK as it's missing the string header. Therefore we
should check for both the library and the header file.
Fixes: 5364de644a4b ("eal: support strlcpy function")
Signed-off-by: Bruce Richarson <bruce.richardson@intel.com>
---
config/meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/config/meson.build b/config/meson.build
index 5815b5602..2179c689c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -43,7 +43,8 @@ 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()
+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'
--
2.14.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/3] build: fix check for libbsd in meson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 2/3] build: fix check for libbsd in meson Bruce Richardson
@ 2018-04-27 13:51 ` Bruce Richardson
2018-04-27 17:51 ` Vladimir Medvedkin
0 siblings, 1 reply; 14+ messages in thread
From: Bruce Richardson @ 2018-04-27 13:51 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, bluca
On Fri, Apr 27, 2018 at 02:49:27PM +0100, Bruce Richardson wrote:
> When we check for libbsd we were just checking for the library itself.
> However, on some distros, e.g. CentOS, libbsd will be found even though
> it's not usable by DPDK as it's missing the string header. Therefore we
> should check for both the library and the header file.
>
> Fixes: 5364de644a4b ("eal: support strlcpy function")
>
Sorry, forgot to add:
Reported-by: Vladimir Medvedkin <medvedkinv@gmail.com>
> Signed-off-by: Bruce Richarson <bruce.richardson@intel.com>
> ---
> config/meson.build | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/config/meson.build b/config/meson.build
> index 5815b5602..2179c689c 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -43,7 +43,8 @@ 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()
> +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'
> --
> 2.14.3
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/3] build: fix check for libbsd in meson
2018-04-27 13:51 ` Bruce Richardson
@ 2018-04-27 17:51 ` Vladimir Medvedkin
0 siblings, 0 replies; 14+ messages in thread
From: Vladimir Medvedkin @ 2018-04-27 17:51 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, hemant.agrawal, bluca
Hi,
2018-04-27 16:51 GMT+03:00 Bruce Richardson <bruce.richardson@intel.com>:
> On Fri, Apr 27, 2018 at 02:49:27PM +0100, Bruce Richardson wrote:
> > When we check for libbsd we were just checking for the library itself.
> > However, on some distros, e.g. CentOS, libbsd will be found even though
> > it's not usable by DPDK as it's missing the string header. Therefore we
> > should check for both the library and the header file.
> >
> > Fixes: 5364de644a4b ("eal: support strlcpy function")
> >
>
> Sorry, forgot to add:
>
> Reported-by: Vladimir Medvedkin <medvedkinv@gmail.com>
>
> > Signed-off-by: Bruce Richarson <bruce.richardson@intel.com>
> > ---
> > config/meson.build | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/config/meson.build b/config/meson.build
> > index 5815b5602..2179c689c 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -43,7 +43,8 @@ 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()
> > +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'
> > --
> > 2.14.3
> >
>
Acked-by: Vladimir Medvedkin <medvedkinv@gmail.com>
--
Regards,
Vladimir
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2 3/3] build: ensure compatibility with future meson versions
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Bruce Richardson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 1/3] build: fix kernel compile on cross-build Bruce Richardson
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 2/3] build: fix check for libbsd in meson Bruce Richardson
@ 2018-04-27 13:49 ` Bruce Richardson
2018-04-27 14:37 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Luca Boccassi
3 siblings, 0 replies; 14+ messages in thread
From: Bruce Richardson @ 2018-04-27 13:49 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, bluca, Bruce Richardson
Meson 0.46 fixed a bug where "extract_all_objects" would not recursively
extract objects not compiled from source for a target. To keep backward
compatibility, a "recursive" keyword-arg was added to make this optional.
The value is "false" by default for now, but will change to "true" in
future, so we hard-code it to "false" in our code to ensure future
compatiblity.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/meson.build b/lib/meson.build
index 73d6f25c7..ae445153b 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -96,7 +96,7 @@ foreach l:libraries
# then use pre-build objects to build shared lib
sources = []
- objs += static_lib.extract_all_objects()
+ objs += static_lib.extract_all_objects(recursive: false)
version_map = '@0@/@1@/rte_@2@_version.map'.format(
meson.current_source_dir(), dir_name, name)
shared_lib = shared_library(libname,
--
2.14.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] small improvements to meson build
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Bruce Richardson
` (2 preceding siblings ...)
2018-04-27 13:49 ` [dpdk-dev] [PATCH v2 3/3] build: ensure compatibility with future meson versions Bruce Richardson
@ 2018-04-27 14:37 ` Luca Boccassi
2018-05-08 20:22 ` Bruce Richardson
3 siblings, 1 reply; 14+ messages in thread
From: Luca Boccassi @ 2018-04-27 14:37 UTC (permalink / raw)
To: Bruce Richardson, dev; +Cc: hemant.agrawal
On Fri, 2018-04-27 at 14:49 +0100, Bruce Richardson wrote:
> A few small improvements and fixes for the meson build system,
> including
> improved behaviour for building kmods - especially on cross-compile,
> a fix
> for our libbsd detect on CentOS 7, and a small change to ensure
> compatibility
> with future meson versions.
>
> Bruce Richardson (3):
> build: fix kernel compile on cross-build
> build: fix check for libbsd in meson
> build: ensure compatibility with future meson versions
>
> config/meson.build | 3 ++-
> kernel/linux/igb_uio/meson.build | 6 ------
> kernel/linux/meson.build | 40
> +++++++++++++++++++++++++++++++++++++---
> lib/meson.build | 2 +-
> meson.build | 6 +++++-
> 5 files changed, 45 insertions(+), 12 deletions(-)
Series-acked-by: Luca Boccassi <bluca@debian.org>
LGTM!
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] small improvements to meson build
2018-04-27 14:37 ` [dpdk-dev] [PATCH v2 0/3] small improvements to meson build Luca Boccassi
@ 2018-05-08 20:22 ` Bruce Richardson
0 siblings, 0 replies; 14+ messages in thread
From: Bruce Richardson @ 2018-05-08 20:22 UTC (permalink / raw)
To: Luca Boccassi; +Cc: dev, hemant.agrawal
On Fri, Apr 27, 2018 at 03:37:10PM +0100, Luca Boccassi wrote:
> On Fri, 2018-04-27 at 14:49 +0100, Bruce Richardson wrote:
> > A few small improvements and fixes for the meson build system,
> > including
> > improved behaviour for building kmods - especially on cross-compile,
> > a fix
> > for our libbsd detect on CentOS 7, and a small change to ensure
> > compatibility
> > with future meson versions.
> >
> > Bruce Richardson (3):
> > build: fix kernel compile on cross-build
> > build: fix check for libbsd in meson
> > build: ensure compatibility with future meson versions
> >
> > config/meson.build | 3 ++-
> > kernel/linux/igb_uio/meson.build | 6 ------
> > kernel/linux/meson.build | 40
> > +++++++++++++++++++++++++++++++++++++---
> > lib/meson.build | 2 +-
> > meson.build | 6 +++++-
> > 5 files changed, 45 insertions(+), 12 deletions(-)
>
> Series-acked-by: Luca Boccassi <bluca@debian.org>
>
Applied to dpdk-next-build
Bruce
^ permalink raw reply [flat|nested] 14+ messages in thread