build system improvements
Subsystems (2)
cover build system improvements
While testing compilation of mlx drivers,
I hit some issues and misses.
The result is 6 patches of cleanup, fixes and test improvements.
Thomas Monjalon (6):
build: remove redundant libs from pkgconfig
drivers: add some reasons for meson disabling net/mlx: fix meson build with custom dependency path net/mlx: fix build with make and recent gcc
devtools: test compiler availability only once
devtools: load target-specific compilation environment
devtools/test-meson-builds.sh | 52 +++++++++++++++++---------- drivers/baseband/turbo_sw/meson.build | 1 + drivers/compress/isal/meson.build | 1 - drivers/net/af_xdp/meson.build | 1 - drivers/net/memif/meson.build | 5 +-- drivers/net/mlx4/Makefile | 3 +- drivers/net/mlx4/meson.build | 9 ++--- drivers/net/mlx5/Makefile | 3 +- drivers/net/mlx5/meson.build | 7 ++-- drivers/raw/ioat/meson.build | 1 + 10 files changed, 52 insertions(+), 31 deletions(-)
Signature · 1 line
2.22.0
PATCH 1/6 build: remove redundant libs from pkgconfig
As explained in drivers/meson.build,
"
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.
"
The commit e30b4e566f47 ("build: improve dependency handling") must be followed up with this one in order to remove more occurences of pkgconfig_extra_libs redundant with use of dependency().
--- drivers/compress/isal/meson.build | 1 - drivers/net/af_xdp/meson.build | 1 - 2 files changed, 2 deletions(-)
drivers/compress/isal/meson.build +0 -1
@@ -10,6 +10,5 @@ endif deps += 'bus_vdev' sources = files('isal_compress_pmd.c', 'isal_compress_pmd_ops.c') ext_deps += dep -pkgconfig_extra_libs += '-lisal' allow_experimental_apis = true
drivers/net/af_xdp/meson.build +0 -1
@@ -10,7 +10,6 @@ endif if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h') ext_deps += bpf_dep - pkgconfig_extra_libs += '-lbpf' else build = false reason = 'missing dependency, "libbpf"'
Signature · 1 line
2.22.0
Re: [dpdk-dev] [PATCH 1/6] build: remove redundant libs from pkgconfig
Quoted 62 lines · Thomas Monjalon
As explained in
drivers/meson.build,
"
For thefind_library()case (but not withdependency()) we also need to specify the "-l" flags inpkgconfig_extra_libsvariable too, so that it can be reflected in the pkgconfig output for static builds.
"The commit
e30b4e566f47("build: improve dependency handling") must be followed up with this one in order to remove more occurences ofpkgconfig_extra_libsredundant with use ofdependency().Fixes f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")Fixes 3c32e89f68e1 ("compress/isal: add skeleton ISA-L compressionPMD")
Cc:
[email protected]Signed-off-by: Thomas Monjalon <
[email protected]Quoted 1 line
--- drivers/compress/isal/meson.build | 1 - drivers/net/af_xdp/meson.build | 1 - 2 files changed, 2 deletions(-)drivers/compress/isal/meson.build +0
-1@@ -10,6 +10,5 @@ endif deps += 'bus_vdev' sources = files('isal_compress_pmd.c', 'isal_compress_pmd_ops.c') ext_deps += dep -pkgconfig_extra_libs += '-lisal' allow_experimental_apis = truedrivers/net/af_xdp/meson.build +0
-1@@ -10,7 +10,6 @@ endif if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h') ext_deps += bpf_dep - pkgconfig_extra_libs += '-lbpf' else build = false
Quoted 2 lines
reason = 'missing dependency, "libbpf"'
Signature · 2 lines
Kind regards, Luca Boccassi
PATCH 2/6 drivers: add some reasons for meson disabling
In reply to Thomas MonjalonSome drivers were missing reasons text for their disabling in meson.
--- drivers/baseband/turbo_sw/meson.build | 1 + drivers/net/memif/meson.build | 5 +++-- drivers/raw/ioat/meson.build | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/baseband/turbo_sw/meson.build +1 -0
@@ -7,6 +7,7 @@ if dpdk_conf.has('RTE_BBDEV_SDK_AVX2') lib = cc.find_library('libturbo', dirs: [path + '/lib_turbo'], required: false) if not lib.found() build = false + reason = 'missing dependency, "libturbo"' else ext_deps += cc.find_library('libturbo', dirs: [path + '/lib_turbo'], required: true) ext_deps += cc.find_library('libcrc', dirs: [path + '/lib_crc'], required: true)
drivers/net/memif/meson.build +3 -2
@@ -1,8 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018-2019 Cisco Systems, Inc. All rights reserved. -if host_machine.system() != 'linux' - build = false +if not is_linux + build = false + reason = 'only supported on Linux' endif sources = files('rte_eth_memif.c',
drivers/raw/ioat/meson.build +1 -0
@@ -2,6 +2,7 @@ # Copyright 2019 Intel Corporation build = dpdk_conf.has('RTE_ARCH_X86') +reason = 'only supported on x86' sources = files('ioat_rawdev.c', 'ioat_rawdev_test.c') deps += ['rawdev', 'bus_pci', 'mbuf']
Signature · 1 line
2.22.0
Re: [dpdk-dev] [PATCH 2/6] drivers: add some reasons for meson disabling
Quoted 11 lines · Thomas Monjalon
Some drivers were missing reasons text for their disabling in meson.
Signed-off-by: Thomas Monjalon <
[email protected]Quoted 1 line
--- drivers/baseband/turbo_sw/meson.build | 1 + drivers/net/memif/meson.build | 5 +++-- drivers/raw/ioat/meson.build | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
Signature · 2 lines
Kind regards, Luca Boccassi
PATCH 3/6 net/mlx: fix meson build with custom dependency path
In reply to Thomas MonjalonIf rdma-core is not installed in a standard directory of the system, it is possible to specify the location of the pkgconfig file via an environment variable:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/rdma-core/build/lib/pkgconfig
In this case, the dependency may become mandatory to specify for the configuration tests (checking dependency symbols or fields).
Some spacing is also fixed around.
--- drivers/net/mlx4/meson.build | 9 +++++---- drivers/net/mlx5/meson.build | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/net/mlx4/meson.build +5 -4
@@ -76,7 +76,7 @@ if build # mlx4_autoconf.h file is still generated. # input array for meson member search: # [ "MACRO to define if found", "header for the search", - # "symbol to search","struct member to search" ] + # "symbol to search", "struct member to search" ] # has_member_args = [ [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
@@ -93,12 +93,13 @@ if build ] config = configuration_data() foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2])) + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) endforeach foreach arg:has_member_args - file_prefix = '#include<' + arg[1] + '>' + file_prefix = '#include <' + arg[1] + '>' config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix : file_prefix)) + prefix: file_prefix, dependencies: libs)) endforeach configure_file(output : 'mlx4_autoconf.h', configuration : config) endif
drivers/net/mlx5/meson.build +4 -3
@@ -177,12 +177,13 @@ if build ] config = configuration_data() foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2])) + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) endforeach foreach arg:has_member_args - file_prefix = '#include<' + arg[1] + '>' + file_prefix = '#include <' + arg[1] + '>' config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix : file_prefix)) + prefix : file_prefix, dependencies: libs)) endforeach configure_file(output : 'mlx5_autoconf.h', configuration : config) endif
Signature · 1 line
2.22.0
Re: [dpdk-dev] [PATCH 3/6] net/mlx: fix meson build with custom dependency path
Quoted 21 lines · Thomas Monjalon
If rdma-core is not installed in a standard directory of the system, it is possible to specify the location of the pkgconfig file via an environment variable:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/rdma-core/build/lib/pkgconfigIn this case, the dependency may become mandatory to specify for the configuration tests (checking dependency symbols or fields).
Some spacing is also fixed around.
Fixes 8e4937640022 ("net/mlx4: add external allocator for Verbsobject")
Fixes 1dd7c7e38c19 ("net/mlx4: support meson build")Fixes 96d7c62a70c7 ("net/mlx5: support meson build")Suggested-by: Luca Boccassi <
[email protected]Quoted 1 line
Quoted 7 lines
Signed-off-by: Thomas Monjalon <
[email protected]Quoted 1 line
--- drivers/net/mlx4/meson.build | 9 +++++---- drivers/net/mlx5/meson.build | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-)
Signature · 2 lines
Kind regards, Luca Boccassi
Re: [dpdk-dev] [PATCH 3/6] net/mlx: fix meson build with custom dependency path
In reply to Thomas MonjalonFrom: Thomas Monjalon <[email protected]>
Quoted 10 lines
If rdma-core is not installed in a standard directory of the system, it is possible to specify the location of the pkgconfig file via an environment variable:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/rdma-core/build/lib/pkgconfigIn this case, the dependency may become mandatory to specify for the configuration tests (checking dependency symbols or fields).
Some spacing is also fixed around.
Quoted 7 lines
Fixes 8e4937640022 ("net/mlx4: add external allocator for Verbs object")Fixes 1dd7c7e38c19 ("net/mlx4: support meson build")Fixes 96d7c62a70c7 ("net/mlx5: support meson build")Suggested-by Luca Boccassi <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
PATCH 4/6 net/mlx: fix build with make and recent gcc
In reply to Thomas MonjalonWith VERBOSE=1, this error was seen in debug mode with gcc 9.1:
In file included from /tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
In file included from rdma-core/build/include/infiniband/mlx5dv.h:47:
In file included from rdma-core/build/include/infiniband/verbs.h:46:
In file included from rdma-core/build/include/infiniband/verbs_api.h:66:
In file included from rdma-core/build/include/infiniband/ib_user_ioctl_verbs.h:38:include/rdma/ib_user_verbs.h:161:28: fatal error:
zero size arrays are an extension [-Wzero-length-array]__aligned_u64 driver_data0;
^
1 error generated.
As a result, buildtools/auto-config-h.sh was not generating a correct autoconf file, so the compilation was generating such error:
fatal error: redefinition of 'mlx5_ib_uapi_flow_action_packet_reformat_type'
It is fixed by disabling -pedantic option when calling auto-config-h.sh from the makefile-based system.
--- drivers/net/mlx4/Makefile | 3 ++- drivers/net/mlx5/Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/mlx4/Makefile +2 -1
@@ -68,6 +68,7 @@ endif # User-defined CFLAGS. ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DEBUG),y) CFLAGS += -pedantic -UNDEBUG -DPEDANTIC +AUTO_CONFIG_CFLAGS += -Wno-pedantic else CFLAGS += -DNDEBUG -UPEDANTIC endif
@@ -77,7 +78,7 @@ include $(RTE_SDK)/mk/rte.lib.mk # Generate and clean-up mlx4_autoconf.h. export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS -export AUTO_CONFIG_CFLAGS = -Wno-error +export AUTO_CONFIG_CFLAGS += -Wno-error ifndef V AUTOCONF_OUTPUT := >/dev/null
drivers/net/mlx5/Makefile +2 -1
@@ -83,6 +83,7 @@ endif # User-defined CFLAGS. ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y) CFLAGS += -pedantic -UNDEBUG -DPEDANTIC +AUTO_CONFIG_CFLAGS += -Wno-pedantic else CFLAGS += -DNDEBUG -UPEDANTIC endif
@@ -92,7 +93,7 @@ include $(RTE_SDK)/mk/rte.lib.mk # Generate and clean-up mlx5_autoconf.h. export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS -export AUTO_CONFIG_CFLAGS = -Wno-error +export AUTO_CONFIG_CFLAGS += -Wno-error ifndef V AUTOCONF_OUTPUT := >/dev/null
Signature · 1 line
2.22.0
Re: [dpdk-dev] [dpdk-stable] [PATCH 4/6] net/mlx: fix build with make and recent gcc
Quoted 29 lines · Thomas Monjalon
With VERBOSE=1, this error was seen in debug mode with gcc 9.1:
In file included from
/tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
In file included fromrdma-core/build/include/infiniband/mlx5dv.h:47:
In file included fromrdma-core/build/include/infiniband/verbs.h:46:
In file included from rdma-core/build/include/infiniband/verbs_api.h:66:
In file included from rdma-core/build/include/infiniband/ib_user_ioctl_verbs.h:38:include/rdma/ib_user_verbs.h:161:28: fatal error:
zero size arrays are an extension [-Wzero-length-array]__aligned_u64driver_data0;
^
1 error generated.As a result,
buildtools/auto-config-h.shwas not generating a correct autoconf file, so the compilation was generating such error:fatal error: redefinition of
'mlx5_ib_uapi_flow_action_packet_reformat_type'It is fixed by disabling -pedantic option when calling auto-config-
h.sh
from the makefile-based system.
Quoted 7 lines
Signed-off-by: Thomas Monjalon <
[email protected]Quoted 1 line
Signature · 2 lines
Kind regards, Luca Boccassi
Re: [dpdk-dev] [PATCH 4/6] net/mlx: fix build with make and recent gcc
In reply to Thomas MonjalonFrom: Thomas Monjalon <[email protected]>
Quoted 20 lines
With VERBOSE=1, this error was seen in debug mode with gcc 9.1:
In file included from
/tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
In file included fromrdma-core/build/include/infiniband/mlx5dv.h:47:
In file included fromrdma-core/build/include/infiniband/verbs.h:46:
In file included fromrdma-core/build/include/infiniband/verbs_api.h:66:
In file included from rdma-core/build/include/infiniband/ib_user_ioctl_verbs.h:38:include/rdma/ib_user_verbs.h:161:28: fatal error:
zero size arrays are an extension [-Wzero-length-array]__aligned_u64driver_data0;
^
1 error generated.As a result,
buildtools/auto-config-h.shwas not generating a correct autoconf file, so the compilation was generating such error:fatal error: redefinition of
'mlx5_ib_uapi_flow_action_packet_reformat_type'
Quoted 7 lines
It is fixed by disabling -pedantic option when calling
auto-config-h.shfrom the makefile-based system.Signed-off-by Thomas Monjalon <[email protected]>
Consider to create more patches to cleanup the compiler commands to ignore pedantic in the code.
Matan
PATCH 5/6 devtools: test compiler availability only once
In reply to Thomas MonjalonThe compilation test is skipped if the compiler is not available. In the case of gcc/arm, it was tested both in the generic function "build" and in the cross-compilation section.
By passing the compiler as argument of the generic function, the test with "command" is done only once.
This small clean-up has the benefit of introducing the compiler parameter to be used later in another improvement.
--- devtools/test-meson-builds.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
devtools/test-meson-builds.sh +16 -17
@@ -29,11 +29,13 @@ else exit 1 fi -build () # <directory> <meson options> +build () # <directory> <target compiler> <meson options> { builddir=$1 shift - if command -v $CC >/dev/null 2>&1 ; then + targetcc=$1 + shift + if command -v $CC $targetcc >/dev/null 2>&1 ; then if [ ! -f "$builddir/build.ninja" ] ; then options="--werror -Dexamples=all $*" echo "$MESON $options $srcdir $builddir"
@@ -71,7 +73,7 @@ for c in gcc clang ; do command -v $c >/dev/null 2>&1 || continue for s in static shared ; do export CC="ccache $c" - build build-$c-$s --default-library=$s + build build-$c-$s $c --default-library=$s done done
@@ -83,22 +85,19 @@ ok=$(cc -march=$default_machine -E - < /dev/null > /dev/null 2>&1 || echo false) if [ "$ok" = "false" ] ; then default_machine='corei7' fi -build build-x86-default -Dlibdir=lib -Dmachine=$default_machine $use_shared +build build-x86-default cc -Dlibdir=lib -Dmachine=$default_machine $use_shared -# enable cross compilation if gcc cross-compiler is found c=aarch64-linux-gnu-gcc -if command -v $c >/dev/null 2>&1 ; then - # compile the general v8a also for clang to increase coverage - export CC="clang" - build build-arm64-host-clang $use_shared \ - --cross-file $srcdir/config/arm/arm64_armv8_linux_gcc - - for f in $srcdir/config/arm/arm*gcc ; do - export CC="ccache gcc" - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \ - $use_shared --cross-file $f - done -fi +# generic armv8a with clang as host compiler +export CC="clang" +build build-arm64-host-clang $c $use_shared \ + --cross-file $srcdir/config/arm/arm64_armv8_linux_gcc +# all gcc/arm configurations +for f in $srcdir/config/arm/arm*gcc ; do + export CC="ccache gcc" + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) $c \ + $use_shared --cross-file $f +done # Test installation of the x86-default target, to be used for checking # the sample apps build using the pkg-config file for cflags and libs
Signature · 1 line
2.22.0
Re: [dpdk-dev] [PATCH 5/6] devtools: test compiler availability only once
Quoted 10 lines · Thomas Monjalon
The compilation test is skipped if the compiler is not available. In the case of gcc/arm, it was tested both in the generic function "build" and in the cross-compilation section.
By passing the compiler as argument of the generic function, the test with "command" is done only once.
This small clean-up has the benefit of introducing the compiler parameter to be used later in another improvement.
Quoted 6 lines
Signed-off-by: Thomas Monjalon <
[email protected]Quoted 1 line
--- devtools/test-meson-builds.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
Signature · 2 lines
Kind regards, Luca Boccassi
PATCH 6/6 devtools: load target-specific compilation environment
In reply to Thomas MonjalonIn order to re-use the same test environment as with test-build.sh, the configuration file is loaded at each build, after adjusting the variable DPDK_TARGET.
This is especially useful to set the variable PKG_CONFIG_PATH, or define some meson options (without -D) in DPDK_MESON_OPTIONS.
The DPDK_TARGET values can be
aarch64-*, powerpc64-*, x86_64-*. The matching DPDK_TARGET values for test-build.sh are arm64-*, ppc_64-*, x86_64-*. The advised expressions to use in the common configuration file are: if echo $DPDK_TARGET | grep -q '^a.*64-' ; then elif echo $DPDK_TARGET | grep -q '^p.*pc.*64' ; then elif echo $DPDK_TARGET | grep -q '^x86_64' ; then fi
--- devtools/test-meson-builds.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
devtools/test-meson-builds.sh +18 -1
@@ -29,15 +29,32 @@ else exit 1 fi +default_path=$PATH +default_pkgpath=$PKG_CONFIG_PATH + +reset_env () +{ + export PATH=$default_path + export PKG_CONFIG_PATH=$default_pkgpath + unset DPDK_MESON_OPTIONS +} + build () # <directory> <target compiler> <meson options> { builddir=$1 shift targetcc=$1 shift + reset_env + DPDK_TARGET=$($targetcc -v 2>&1 | sed -n 's,^Target: ,,p') + . $srcdir/devtools/load-devel-config if command -v $CC $targetcc >/dev/null 2>&1 ; then if [ ! -f "$builddir/build.ninja" ] ; then - options="--werror -Dexamples=all $*" + options="--werror -Dexamples=all" + for option in $DPDK_MESON_OPTIONS ; do + options="$options -D$option" + done + options="$options $*" echo "$MESON $options $srcdir $builddir" $MESON $options $srcdir $builddir unset CC
Signature · 1 line
2.22.0
Re: [dpdk-dev] [PATCH 6/6] devtools: load target-specific compilation environment
Quoted 17 lines · Thomas Monjalon
In order to re-use the same test environment as with
test-build.sh, the configuration file is loaded at each build, after adjusting the variableDPDK_TARGET.This is especially useful to set the variable
PKG_CONFIG_PATH, or define some meson options (without -D) inDPDK_MESON_OPTIONS.The
DPDK_TARGETvalues can beaarch64-*, powerpc64-*, x86_64-*. The matching DPDK_TARGET values for test-build.sh are arm64-*, ppc_64-*, x86_64-*. The advised expressions to use in the common configuration file are: if echo $DPDK_TARGET | grep -q '^a.*64-' ; then elif echo $DPDK_TARGET | grep -q '^p.*pc.*64' ; then elif echo $DPDK_TARGET | grep -q '^x86_64' ; then fi
Quoted 6 lines
Signed-off-by: Thomas Monjalon <
[email protected]Quoted 1 line
--- devtools/test-meson-builds.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
Signature · 2 lines
Kind regards, Luca Boccassi
Thomas Monjalon
Applied13/08/2019 01:03, Thomas Monjalon:
Quoted 12 lines
While testing compilation of mlx drivers,
I hit some issues and misses.
The result is 6 patches of cleanup, fixes and test improvements.Thomas Monjalon (6):
build: remove redundant libs from pkgconfig
drivers: add some reasons for meson disabling net/mlx: fix meson build with custom dependency path net/mlx: fix build with make and recent gcc
devtools: test compiler availability only once
devtools: load target-specific compilation environment
Quoted 11 lines
devtools/test-meson-builds.sh | 52 +++++++++++++++++---------- drivers/baseband/turbo_sw/meson.build | 1 + drivers/compress/isal/meson.build | 1 - drivers/net/af_xdp/meson.build | 1 - drivers/net/memif/meson.build | 5 +-- drivers/net/mlx4/Makefile | 3 +- drivers/net/mlx4/meson.build | 9 ++--- drivers/net/mlx5/Makefile | 3 +- drivers/net/mlx5/meson.build | 7 ++-- drivers/raw/ioat/meson.build | 1 + 10 files changed, 52 insertions(+), 31 deletions(-)
Applied