* [dpdk-dev] [PATCH v7 1/7] mk: fix cross build errors
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 2/7] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (6 subsequent siblings)
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: gavin hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v7 2/7] doc: add a guide doc for cross compiling from x86
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 1/7] mk: fix cross build errors Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 3/7] devtools: fix the Exec format error Gavin Hu
` (5 subsequent siblings)
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: gavin hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 138 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..551f0aef8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
+ _aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section:
+ https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _argment_the_cross_toolcain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files to the cross compiler's include directory:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
+ CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+ argmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
+ "-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+
+For example if the target machine is arm64 we can use the following
+command::
+ meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v7 3/7] devtools: fix the Exec format error
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 1/7] mk: fix cross build errors Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 2/7] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 4/7] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: stable
meson will natively compile and generate the sanitycheck.exe file. It will
be spawned and run at the host side. Export the cross compiler is not
necessary as it is already done by the cross-file, and even worse it
generate the files in the wrong target format.
The fix to the following compiling error is select the native compiler for
the sanity test source file.
"/usr/lib/python3.5/subprocess.py", line 676, in __init__ restore_signals,
start_new_session) File "/usr/lib/python3.5/subprocess.py", line 1282, in
_execute_child raise child_exception_type(errno_num, err_msg) OSError:
[Errno 8] Exec format error
Build started at 2018-06-01T12:48:46.852286 Main binary: /usr/bin/python3
Python system: Linux The Meson build system Version: 0.45.1 Build type:
cross build Project name: DPDK Sanity testing C compiler:
aarch64-linux-gnu-gcc Is cross compiler: False. Sanity check compiler
command line: aarch64-linux-gnu-gcc
dpdk/build-arm64-armv8/meson-private/sanitycheckc.c -o
dpdk/build-arm64-armv8/meson-private/sanitycheckc.exe
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9868c325b..6bce3df7f 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -1,6 +1,7 @@
#! /bin/sh -e
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018 ARM Corporation
# Run meson to auto-configure the various builds.
# * all builds get put in a directory whose name starts with "build-"
@@ -18,7 +19,6 @@ build () # <directory> <meson options>
options="--werror -Dexamples=all $*"
echo "$MESON $options $srcdir $builddir"
$MESON $options $srcdir $builddir
- unset CC
fi
echo "ninja -C $builddir"
ninja -C $builddir
@@ -26,10 +26,11 @@ build () # <directory> <meson options>
# shared and static linked builds with gcc and clang
for c in gcc clang ; do
+ export CC="ccache $c"
for s in static shared ; do
- export CC="ccache $c"
build build-$c-$s --default-library=$s
done
+ unset CC
done
# test compilation with minimal x86 instruction set
@@ -39,8 +40,10 @@ build build-x86-default -Dmachine=nehalem
for f in config/arm/arm*gcc ; do
c=aarch64-linux-gnu-gcc
if ! command -v $c >/dev/null 2>&1 ; then
- continue
+ echo "## ERROR: aarch64-linux-gnu-gcc is missing..."
+ exit 1
fi
- export CC="ccache $c"
+ export CC="ccache gcc"
build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ unset CC
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v7 4/7] build: fix the meson build warning
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 3/7] devtools: fix the Exec format error Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 5/7] devtools: fix the missing ninja command error on CentOS Gavin Hu
` (3 subsequent siblings)
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v7 5/7] devtools: fix the missing ninja command error on CentOS
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 4/7] build: fix the meson build warning Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 6/7] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: stable
On CentOS, the ninja executable has a different name:
ninja-build, this patch is to fix the missing command error
on CentOS as follows:
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 6bce3df7f..15a282978 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -11,6 +11,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -21,7 +30,7 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
fi
echo "ninja -C $builddir"
- ninja -C $builddir
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v7 6/7] build: fix the meson cross compile error
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 5/7] devtools: fix the missing ninja command error on CentOS Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 7/7] devtools: expand meson cross compiling coverage Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v7 7/7] devtools: expand meson cross compiling coverage
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 6/7] build: fix the meson cross compile error Gavin Hu
@ 2018-06-15 7:08 ` Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
7 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 7:08 UTC (permalink / raw)
To: dev; +Cc: stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to cover both, gcc and clang. And also the build dirs are
changed to *-host-$c, indicating the difference of cc used.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 15a282978..879eda18e 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -51,8 +51,16 @@ for f in config/arm/arm*gcc ; do
if ! command -v $c >/dev/null 2>&1 ; then
echo "## ERROR: aarch64-linux-gnu-gcc is missing..."
exit 1
- fi
- export CC="ccache gcc"
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
- unset CC
+ fi
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
+ --cross-file $f
+ unset CC
+ # compile the general v8a also for clang to increase coverage
+ if [ $f = config/arm/arm64_armv8_linuxapp_gcc ] ; then
+ export CC="ccache clang"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
+ --cross-file $f
+ unset CC
+ fi
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 0/7] fix the cross compiling errors Gavin Hu
` (6 preceding siblings ...)
2018-06-15 7:08 ` [dpdk-dev] [PATCH v7 7/7] devtools: expand meson cross compiling coverage Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 1/6] mk: fix cross build errors Gavin Hu
` (6 more replies)
7 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error on CentOS
build: fix the meson cross compile error
devtools: expand meson cross compiling coverage
gavin hu (2):
mk: fix cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 23 +++-
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 193 insertions(+), 6 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 1/6] mk: fix cross build errors
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 2/6] doc: add a guide doc for cross compiling from x86
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 1/6] mk: fix cross build errors Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 138 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..551f0aef8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
+ _aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section:
+ https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _argment_the_cross_toolcain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files to the cross compiler's include directory:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
+ CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+ argmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
+ "-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+
+For example if the target machine is arm64 we can use the following
+command::
+ meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 3/6] build: fix the meson build warning
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 1/6] mk: fix cross build errors Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 4/6] devtools: fix the missing ninja command error on CentOS Gavin Hu
` (3 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 4/6] devtools: fix the missing ninja command error on CentOS
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:24 ` Bruce Richardson
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On CentOS, the ninja executable has a different name:
ninja-build, this patch is to fix the missing command error
on CentOS as follows:
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..8447c704b 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -21,7 +30,7 @@ build () # <directory> <meson options>
unset CC
fi
echo "ninja -C $builddir"
- ninja -C $builddir
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v8 4/6] devtools: fix the missing ninja command error on CentOS
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 4/6] devtools: fix the missing ninja command error on CentOS Gavin Hu
@ 2018-06-15 8:24 ` Bruce Richardson
0 siblings, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-15 8:24 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Fri, Jun 15, 2018 at 04:01:18PM +0800, Gavin Hu wrote:
> On CentOS, the ninja executable has a different name:
> ninja-build, this patch is to fix the missing command error
> on CentOS as follows:
> ./devtools/test-meson-builds.sh: line 24: ninja: command not found
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
> devtools/test-meson-builds.sh | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index f2ad05f32..8447c704b 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -10,6 +10,15 @@
> srcdir=$(dirname $(readlink -m $0))/..
> MESON=${MESON:-meson}
>
> +if command -v ninja >/dev/null 2>&1 ; then
> + ninja_cmd=ninja
> +elif command -v ninja-build >/dev/null 2>&1 ; then
> + ninja_cmd=ninja-build
> +else
> + echo "## ERROR: ninja is missing, please install..."
> + exit 1
> +fi
> +
> build () # <directory> <meson options>
> {
> builddir=$1
> @@ -21,7 +30,7 @@ build () # <directory> <meson options>
> unset CC
> fi
> echo "ninja -C $builddir"
> - ninja -C $builddir
> + $ninja_cmd -C $builddir
I think the command-name should be updated in the echo print too. [Perhaps
that can be done on apply]. With that minor change:
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 5/6] build: fix the meson cross compile error
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 4/6] devtools: fix the missing ninja command error on CentOS Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross compiling coverage Gavin Hu
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross compiling coverage
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-15 8:01 ` Gavin Hu
2018-06-15 8:28 ` Bruce Richardson
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 8:01 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to cover both, gcc and clang. And also the build dirs are
changed to *-host-$c, indicating the difference of cc used.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 8447c704b..f75ebbdb1 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -50,5 +50,15 @@ for f in config/arm/arm*gcc ; do
if ! command -v $c >/dev/null 2>&1 ; then
continue
fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
+ --cross-file $f
+ unset CC
+ # compile the general v8a also for clang to increase coverage
+ if [ $f = config/arm/arm64_armv8_linuxapp_gcc ] ; then
+ export CC="ccache clang"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
+ --cross-file $f
+ unset CC
+ fi
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross compiling coverage
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross compiling coverage Gavin Hu
@ 2018-06-15 8:28 ` Bruce Richardson
2018-06-15 9:31 ` Gavin Hu
0 siblings, 1 reply; 84+ messages in thread
From: Bruce Richardson @ 2018-06-15 8:28 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Fri, Jun 15, 2018 at 04:01:20PM +0800, Gavin Hu wrote:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to cover both, gcc and clang. And also the build dirs are
> changed to *-host-$c, indicating the difference of cc used.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
> devtools/test-meson-builds.sh | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 8447c704b..f75ebbdb1 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -50,5 +50,15 @@ for f in config/arm/arm*gcc ; do
> if ! command -v $c >/dev/null 2>&1 ; then
> continue
> fi
> - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> + export CC="ccache gcc"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> + --cross-file $f
> + unset CC
> + # compile the general v8a also for clang to increase coverage
> + if [ $f = config/arm/arm64_armv8_linuxapp_gcc ] ; then
> + export CC="ccache clang"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
> + --cross-file $f
> + unset CC
> + fi
Indentation is different in the new code, spaces vs tabs, perhaps. I'm also
not sure the "unset CC" is needed, because I think the build function
automatically unsets it when done.
One other style comment: rather than having an if condition in the loop and
putting the extra build there, it might be easier just to put the extra
call to build outside the main loop, since all values are essentially
hardcoded in that call anyway.
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross compiling coverage
2018-06-15 8:28 ` Bruce Richardson
@ 2018-06-15 9:31 ` Gavin Hu
0 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:31 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, nd, stable
Hi Bruce,
Thanks for your review, new v9 patch set was submitted.
Any more comments are welcome!
Best Regards,
Gavin
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Friday, June 15, 2018 4:28 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross
> compiling coverage
>
> On Fri, Jun 15, 2018 at 04:01:20PM +0800, Gavin Hu wrote:
> > The default test script covers only default host cc compiler, either
> > gcc or clang, the fix is to cover both, gcc and clang. And also the
> > build dirs are changed to *-host-$c, indicating the difference of cc used.
> >
> > Fixes: a55277a788 ("devtools: add test script for meson builds")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Song Zhu <song.zhu@arm.com>
> > ---
> > devtools/test-meson-builds.sh | 12 +++++++++++-
> > 1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/devtools/test-meson-builds.sh
> > b/devtools/test-meson-builds.sh index 8447c704b..f75ebbdb1 100755
> > --- a/devtools/test-meson-builds.sh
> > +++ b/devtools/test-meson-builds.sh
> > @@ -50,5 +50,15 @@ for f in config/arm/arm*gcc ; do
> > if ! command -v $c >/dev/null 2>&1 ; then
> > continue
> > fi
> > - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> > + export CC="ccache gcc"
> > + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> > + --cross-file $f
> > + unset CC
> > + # compile the general v8a also for clang to increase coverage
> > + if [ $f = config/arm/arm64_armv8_linuxapp_gcc ] ; then
> > + export CC="ccache clang"
> > + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
> > + --cross-file $f
> > + unset CC
> > + fi
>
> Indentation is different in the new code, spaces vs tabs, perhaps. I'm also not
> sure the "unset CC" is needed, because I think the build function
> automatically unsets it when done.
>
> One other style comment: rather than having an if condition in the loop and
> putting the extra build there, it might be easier just to put the extra call to
> build outside the main loop, since all values are essentially hardcoded in that
> call anyway.
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-15 8:01 ` [dpdk-dev] [PATCH v8 6/6] devtools: expand meson cross compiling coverage Gavin Hu
@ 2018-06-15 9:25 ` Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 1/6] mk: fix makefile based cross build errors Gavin Hu
` (6 more replies)
6 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:25 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
5. v8 some minor changes to address the comments, as well some commit message refined.
a) move if clause out of the loop for a better program structure.
b) echo the correct ninja command actually used.
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error
build: fix the meson cross compile error
devtools: expand meson cross compiling test coverage
gavin hu (2):
mk: fix makefile based cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 26 +++-
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 194 insertions(+), 8 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 1/6] mk: fix makefile based cross build errors
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-15 9:26 ` Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:26 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 2/6] doc: add a guide doc for cross compiling from x86
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-15 9:26 ` Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:26 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 138 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..551f0aef8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
+ _aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section:
+ https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _argment_the_cross_toolcain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files to the cross compiler's include directory:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
+ CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+ argmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
+ "-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+
+For example if the target machine is arm64 we can use the following
+command::
+ meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 3/6] build: fix the meson build warning
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-15 9:26 ` Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 4/6] devtools: fix the missing ninja command error Gavin Hu
` (3 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:26 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 4/6] devtools: fix the missing ninja command error
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-15 9:26 ` Gavin Hu
2018-06-15 9:59 ` Bruce Richardson
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:26 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..9bb5b93bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -20,8 +29,8 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
unset CC
fi
- echo "ninja -C $builddir"
- ninja -C $builddir
+ echo "$ninja_cmd -C $builddir"
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v9 4/6] devtools: fix the missing ninja command error
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-15 9:59 ` Bruce Richardson
0 siblings, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-15 9:59 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Fri, Jun 15, 2018 at 05:26:03PM +0800, Gavin Hu wrote:
> On some linux distributions, eg: CentOS, the ninja executable has a
> different name: ninja-build, this patch is to check and adapt to it
> accordingly.
>
> ./devtools/test-meson-builds.sh: line 24: ninja: command not found
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
LGTM
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 5/6] build: fix the meson cross compile error
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-15 9:26 ` Gavin Hu
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:26 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v9 6/6] devtools: expand meson cross compiling test coverage
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-15 9:26 ` Gavin Hu
2018-06-15 10:01 ` Bruce Richardson
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 9:26 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to cover both, gcc and clang. And also the build dirs are
changed to *-host-$c, indicating the difference of cc used.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9bb5b93bd..8c33ece93 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -44,11 +44,20 @@ done
# test compilation with minimal x86 instruction set
build build-x86-default -Dmachine=nehalem
+# compile the general v8a also for clang to increase coverage
+f=config/arm/arm64_armv8_linuxapp_gcc
+export CC="ccache clang"
+build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
+ --cross-file $f
+
# enable cross compilation if gcc cross-compiler is found
for f in config/arm/arm*gcc ; do
c=aarch64-linux-gnu-gcc
if ! command -v $c >/dev/null 2>&1 ; then
- continue
+ echo "## ERROR: $c is missing..."
+ exit 1
fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
+ --cross-file $f
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v9 6/6] devtools: expand meson cross compiling test coverage
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-15 10:01 ` Bruce Richardson
0 siblings, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-15 10:01 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Fri, Jun 15, 2018 at 05:26:05PM +0800, Gavin Hu wrote:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to cover both, gcc and clang. And also the build dirs are
> changed to *-host-$c, indicating the difference of cc used.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
Still has whitespace issues which can probably be fixed on apply. The calls
to basename etc. for the additional command are unnecessary since you can
hard-code the directory name, but that's not a big deal. Approach wise, it
looks ok.
With whitespace fixup:
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> devtools/test-meson-builds.sh | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9bb5b93bd..8c33ece93 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -44,11 +44,20 @@ done
> # test compilation with minimal x86 instruction set
> build build-x86-default -Dmachine=nehalem
>
> +# compile the general v8a also for clang to increase coverage
> +f=config/arm/arm64_armv8_linuxapp_gcc
> +export CC="ccache clang"
> +build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
> + --cross-file $f
> +
> # enable cross compilation if gcc cross-compiler is found
> for f in config/arm/arm*gcc ; do
> c=aarch64-linux-gnu-gcc
> if ! command -v $c >/dev/null 2>&1 ; then
> - continue
> + echo "## ERROR: $c is missing..."
> + exit 1
> fi
> - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> + export CC="ccache gcc"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> + --cross-file $f
> done
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors
2018-06-15 9:25 ` [dpdk-dev] [PATCH v9 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-15 9:26 ` [dpdk-dev] [PATCH v9 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 1/6] mk: fix makefile based cross build errors Gavin Hu
` (6 more replies)
6 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
5. v9 some minor changes to address the comments, as well some commit message refined.
a) move if clause out of the loop for a better program structure.
b) echo the correct ninja command actually used.
6. Fix the whitespace issues.
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error
build: fix the meson cross compile error
devtools: expand meson cross compiling test coverage
gavin hu (2):
mk: fix makefile based cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 26 +++-
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 194 insertions(+), 8 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 1/6] mk: fix makefile based cross build errors
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 2/6] doc: add a guide doc for cross compiling from x86
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 138 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..551f0aef8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
+ _aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section:
+ https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _argment_the_cross_toolcain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files to the cross compiler's include directory:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
+ CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+ argmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
+ "-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+
+For example if the target machine is arm64 we can use the following
+command::
+ meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 3/6] build: fix the meson build warning
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 4/6] devtools: fix the missing ninja command error Gavin Hu
` (3 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 4/6] devtools: fix the missing ninja command error
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 13:27 ` Bruce Richardson
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..9bb5b93bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -20,8 +29,8 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
unset CC
fi
- echo "ninja -C $builddir"
- ninja -C $builddir
+ echo "$ninja_cmd -C $builddir"
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v10 4/6] devtools: fix the missing ninja command error
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-15 13:27 ` Bruce Richardson
0 siblings, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-15 13:27 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Fri, Jun 15, 2018 at 06:21:41PM +0800, Gavin Hu wrote:
> On some linux distributions, eg: CentOS, the ninja executable has a
> different name: ninja-build, this patch is to check and adapt to it
> accordingly.
>
> ./devtools/test-meson-builds.sh: line 24: ninja: command not found
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
I think I already acked this one, so
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 5/6] build: fix the meson cross compile error
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross compiling test coverage
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-15 10:21 ` Gavin Hu
2018-06-15 14:14 ` Bruce Richardson
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-15 10:21 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to cover both, gcc and clang. And also the build dirs are
changed to *-host-$c, indicating the difference of cc used.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9bb5b93bd..f1553b7bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -44,11 +44,20 @@ done
# test compilation with minimal x86 instruction set
build build-x86-default -Dmachine=nehalem
+# compile the general v8a also for clang to increase coverage
+f=config/arm/arm64_armv8_linuxapp_gcc
+export CC="ccache clang"
+build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
+ --cross-file $f
+
# enable cross compilation if gcc cross-compiler is found
for f in config/arm/arm*gcc ; do
c=aarch64-linux-gnu-gcc
if ! command -v $c >/dev/null 2>&1 ; then
- continue
+ echo "## ERROR: $c is missing..."
+ exit 1
fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
+ --cross-file $f
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross compiling test coverage
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-15 14:14 ` Bruce Richardson
2018-06-19 1:44 ` Gavin Hu
0 siblings, 1 reply; 84+ messages in thread
From: Bruce Richardson @ 2018-06-15 14:14 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Fri, Jun 15, 2018 at 06:21:43PM +0800, Gavin Hu wrote:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to cover both, gcc and clang. And also the build dirs are
> changed to *-host-$c, indicating the difference of cc used.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
Apologies, some late comments inline below that I missed on previous
reviews.
> devtools/test-meson-builds.sh | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9bb5b93bd..f1553b7bd 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -44,11 +44,20 @@ done
> # test compilation with minimal x86 instruction set
> build build-x86-default -Dmachine=nehalem
>
> +# compile the general v8a also for clang to increase coverage
> +f=config/arm/arm64_armv8_linuxapp_gcc
> +export CC="ccache clang"
> +build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
> + --cross-file $f
> +
This might be better just as e.g.
+export CC="ccache clang"
+build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
to be shorter and more readable. You don't really need the armv8 part in
the directory name, as it's primarily a test of the clang host build, so
you can omit it to shorten the command to a single line with all hardcoded
values, which is more readable than a version with tr filename mangling.
> # enable cross compilation if gcc cross-compiler is found
> for f in config/arm/arm*gcc ; do
> c=aarch64-linux-gnu-gcc
> if ! command -v $c >/dev/null 2>&1 ; then
> - continue
> + echo "## ERROR: $c is missing..."
> + exit 1
I think this if check should be moved out of the block, and be before the
test with clang, since that clang test will also fail.
> fi
> - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> + export CC="ccache gcc"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> + --cross-file $f
> done
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross compiling test coverage
2018-06-15 14:14 ` Bruce Richardson
@ 2018-06-19 1:44 ` Gavin Hu
0 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:44 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, nd, stable
Hi Bruce,
I submitted v11, please have a look, thanks for your review.
Best Regards,
Gavin
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Friday, June 15, 2018 10:15 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross
> compiling test coverage
>
> On Fri, Jun 15, 2018 at 06:21:43PM +0800, Gavin Hu wrote:
> > The default test script covers only default host cc compiler, either
> > gcc or clang, the fix is to cover both, gcc and clang. And also the
> > build dirs are changed to *-host-$c, indicating the difference of cc used.
> >
> > Fixes: a55277a788 ("devtools: add test script for meson builds")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Song Zhu <song.zhu@arm.com>
> > ---
>
> Apologies, some late comments inline below that I missed on previous
> reviews.
>
> > devtools/test-meson-builds.sh | 13 +++++++++++--
> > 1 file changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/devtools/test-meson-builds.sh
> > b/devtools/test-meson-builds.sh index 9bb5b93bd..f1553b7bd 100755
> > --- a/devtools/test-meson-builds.sh
> > +++ b/devtools/test-meson-builds.sh
> > @@ -44,11 +44,20 @@ done
> > # test compilation with minimal x86 instruction set build
> > build-x86-default -Dmachine=nehalem
> >
> > +# compile the general v8a also for clang to increase coverage
> > +f=config/arm/arm64_armv8_linuxapp_gcc
> > +export CC="ccache clang"
> > +build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-clang \
> > + --cross-file $f
> > +
>
> This might be better just as e.g.
>
> +export CC="ccache clang"
> +build build-arm64-host-clang --cross-file
> +config/arm/arm64_armv8_linuxapp_gcc
>
> to be shorter and more readable. You don't really need the armv8 part in the
> directory name, as it's primarily a test of the clang host build, so you can omit
> it to shorten the command to a single line with all hardcoded values, which is
> more readable than a version with tr filename mangling.
>
> > # enable cross compilation if gcc cross-compiler is found for f in
> > config/arm/arm*gcc ; do
> > c=aarch64-linux-gnu-gcc
> > if ! command -v $c >/dev/null 2>&1 ; then
> > - continue
> > + echo "## ERROR: $c is missing..."
> > + exit 1
>
> I think this if check should be moved out of the block, and be before the test
> with clang, since that clang test will also fail.
>
> > fi
> > - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> > + export CC="ccache gcc"
> > + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> > + --cross-file $f
> > done
> > --
> > 2.11.0
> >
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-15 10:21 ` [dpdk-dev] [PATCH v10 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 1/6] mk: fix makefile based cross build errors Gavin Hu
` (6 more replies)
6 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
5. v9 some minor changes to address the comments, as well some commit message refined.
a) move if clause out of the loop for a better program structure.
b) echo the correct ninja command actually used.
6. v10 Fix the whitespace issues.
7. v11 Shorten the command to a single line with all hardcoded values in order to be
shorter and more readable.
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error
build: fix the meson cross compile error
devtools: expand meson cross compiling test coverage
gavin hu (2):
mk: fix makefile based cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 24 +++-
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 192 insertions(+), 8 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 1/6] mk: fix makefile based cross build errors
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 2/6] doc: add a guide doc for cross compiling from x86
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 138 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..551f0aef8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
+ _aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section:
+ https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _argment_the_cross_toolcain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files to the cross compiler's include directory:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
+ CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+ argmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
+ "-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+
+For example if the target machine is arm64 we can use the following
+command::
+ meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 3/6] build: fix the meson build warning
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error Gavin Hu
` (3 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 10:12 ` Bruce Richardson
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..9bb5b93bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -20,8 +29,8 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
unset CC
fi
- echo "ninja -C $builddir"
- ninja -C $builddir
+ echo "$ninja_cmd -C $builddir"
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-19 10:12 ` Bruce Richardson
2018-06-19 10:41 ` Gavin Hu
0 siblings, 1 reply; 84+ messages in thread
From: Bruce Richardson @ 2018-06-19 10:12 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Tue, Jun 19, 2018 at 09:37:44AM +0800, Gavin Hu wrote:
> On some linux distributions, eg: CentOS, the ninja executable has a
> different name: ninja-build, this patch is to check and adapt to it
> accordingly.
>
> ./devtools/test-meson-builds.sh: line 24: ninja: command not found
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
This is previously acked.
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error
2018-06-19 10:12 ` Bruce Richardson
@ 2018-06-19 10:41 ` Gavin Hu
2018-06-19 12:30 ` Bruce Richardson
0 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:41 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, nd, stable
Hi Bruce,
Thanks for your review, I submitted v12 patch to address all your new comments.
BTW, do you know why pwclient can NOT work successfully today?
It worked fine at my side previously, any changes at the server side? The error is below:
xmlrpc.client.ProtocolError: <ProtocolError for dpdk.org/dev/patchwork/xmlrpc/: 301 Moved Permanently>
Best Regards,
Gavin
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, June 19, 2018 6:12 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja
> command error
>
> On Tue, Jun 19, 2018 at 09:37:44AM +0800, Gavin Hu wrote:
> > On some linux distributions, eg: CentOS, the ninja executable has a
> > different name: ninja-build, this patch is to check and adapt to it
> > accordingly.
> >
> > ./devtools/test-meson-builds.sh: line 24: ninja: command not found
> >
> > Fixes: a55277a788 ("devtools: add test script for meson builds")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Song Zhu <song.zhu@arm.com>
> > ---
> This is previously acked.
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error
2018-06-19 10:41 ` Gavin Hu
@ 2018-06-19 12:30 ` Bruce Richardson
2018-06-19 23:58 ` Gavin Hu
0 siblings, 1 reply; 84+ messages in thread
From: Bruce Richardson @ 2018-06-19 12:30 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Tue, Jun 19, 2018 at 10:41:06AM +0000, Gavin Hu wrote:
> Hi Bruce,
>
> Thanks for your review, I submitted v12 patch to address all your new comments.
>
> BTW, do you know why pwclient can NOT work successfully today?
> It worked fine at my side previously, any changes at the server side? The error is below:
> xmlrpc.client.ProtocolError: <ProtocolError for dpdk.org/dev/patchwork/xmlrpc/: 301 Moved Permanently>
>
> Best Regards,
> Gavin
Paths on the server have changed, so you need to update your .pwclientrc
file to point to the new path. Patchwork is now at "patches.dpdk.org"
>
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > Sent: Tuesday, June 19, 2018 6:12 PM
> > To: Gavin Hu <Gavin.Hu@arm.com>
> > Cc: dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja
> > command error
> >
> > On Tue, Jun 19, 2018 at 09:37:44AM +0800, Gavin Hu wrote:
> > > On some linux distributions, eg: CentOS, the ninja executable has a
> > > different name: ninja-build, this patch is to check and adapt to it
> > > accordingly.
> > >
> > > ./devtools/test-meson-builds.sh: line 24: ninja: command not found
> > >
> > > Fixes: a55277a788 ("devtools: add test script for meson builds")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > > Reviewed-by: Phil Yang <phil.yang@arm.com>
> > > Reviewed-by: Song Zhu <song.zhu@arm.com>
> > > ---
> > This is previously acked.
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error
2018-06-19 12:30 ` Bruce Richardson
@ 2018-06-19 23:58 ` Gavin Hu
0 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 23:58 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, nd, stable
Thanks Bruce, it works out with new url:
url=http://patches.dpdk.org/xmlrpc/
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, June 19, 2018 8:30 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja
> command error
>
> On Tue, Jun 19, 2018 at 10:41:06AM +0000, Gavin Hu wrote:
> > Hi Bruce,
> >
> > Thanks for your review, I submitted v12 patch to address all your new
> comments.
> >
> > BTW, do you know why pwclient can NOT work successfully today?
> > It worked fine at my side previously, any changes at the server side? The
> error is below:
> > xmlrpc.client.ProtocolError: <ProtocolError for
> > dpdk.org/dev/patchwork/xmlrpc/: 301 Moved Permanently>
> >
> > Best Regards,
> > Gavin
>
> Paths on the server have changed, so you need to update your .pwclientrc
> file to point to the new path. Patchwork is now at "patches.dpdk.org"
> >
> > > -----Original Message-----
> > > From: Bruce Richardson <bruce.richardson@intel.com>
> > > Sent: Tuesday, June 19, 2018 6:12 PM
> > > To: Gavin Hu <Gavin.Hu@arm.com>
> > > Cc: dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing
> > > ninja command error
> > >
> > > On Tue, Jun 19, 2018 at 09:37:44AM +0800, Gavin Hu wrote:
> > > > On some linux distributions, eg: CentOS, the ninja executable has
> > > > a different name: ninja-build, this patch is to check and adapt to
> > > > it accordingly.
> > > >
> > > > ./devtools/test-meson-builds.sh: line 24: ninja: command not found
> > > >
> > > > Fixes: a55277a788 ("devtools: add test script for meson builds")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > > > Reviewed-by: Phil Yang <phil.yang@arm.com>
> > > > Reviewed-by: Song Zhu <song.zhu@arm.com>
> > > > ---
> > > This is previously acked.
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 5/6] build: fix the meson cross compile error
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-19 1:37 ` Gavin Hu
2018-06-19 10:14 ` Bruce Richardson
2018-06-19 10:15 ` Bruce Richardson
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 2 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 1:37 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to increase the coverage by adding one more to cover
clang and the others for gcc, also the build dirs are changed to *-host-$c,
indicating the difference of cc used.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9bb5b93bd..f0912d109 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -44,11 +44,18 @@ done
# test compilation with minimal x86 instruction set
build build-x86-default -Dmachine=nehalem
+# compile the general v8a also for clang to increase coverage
+export CC="ccache clang"
+build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
+
# enable cross compilation if gcc cross-compiler is found
for f in config/arm/arm*gcc ; do
c=aarch64-linux-gnu-gcc
if ! command -v $c >/dev/null 2>&1 ; then
- continue
+ echo "## ERROR: $c is missing..."
+ exit 1
fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
+ --cross-file $f
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-19 10:14 ` Bruce Richardson
2018-06-19 10:15 ` Bruce Richardson
1 sibling, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-19 10:14 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Tue, Jun 19, 2018 at 09:37:46AM +0800, Gavin Hu wrote:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to increase the coverage by adding one more to cover
> clang and the others for gcc, also the build dirs are changed to *-host-$c,
> indicating the difference of cc used.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
> devtools/test-meson-builds.sh | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9bb5b93bd..f0912d109 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -44,11 +44,18 @@ done
> # test compilation with minimal x86 instruction set
> build build-x86-default -Dmachine=nehalem
>
> +# compile the general v8a also for clang to increase coverage
> +export CC="ccache clang"
> +build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
> +
This will fail if the cross-gcc is not present. You still need to move the
check out of the loop below to above this build call.
> # enable cross compilation if gcc cross-compiler is found
> for f in config/arm/arm*gcc ; do
> c=aarch64-linux-gnu-gcc
> if ! command -v $c >/dev/null 2>&1 ; then
> - continue
> + echo "## ERROR: $c is missing..."
> + exit 1
> fi
> - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> + export CC="ccache gcc"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> + --cross-file $f
Minor nit:
I'd tend to leave off the "host-gcc" part for brevity. If one build is marked
as host-clang, I think most folks unfamiliar with the script will probably
guess that gcc is the host compiler in unstated cases.
> done
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-06-19 10:14 ` Bruce Richardson
@ 2018-06-19 10:15 ` Bruce Richardson
1 sibling, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-19 10:15 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Tue, Jun 19, 2018 at 09:37:46AM +0800, Gavin Hu wrote:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to increase the coverage by adding one more to cover
> clang and the others for gcc, also the build dirs are changed to *-host-$c,
> indicating the difference of cc used.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> ---
> devtools/test-meson-builds.sh | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9bb5b93bd..f0912d109 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -44,11 +44,18 @@ done
> # test compilation with minimal x86 instruction set
> build build-x86-default -Dmachine=nehalem
>
> +# compile the general v8a also for clang to increase coverage
> +export CC="ccache clang"
> +build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
> +
> # enable cross compilation if gcc cross-compiler is found
> for f in config/arm/arm*gcc ; do
> c=aarch64-linux-gnu-gcc
> if ! command -v $c >/dev/null 2>&1 ; then
> - continue
> + echo "## ERROR: $c is missing..."
> + exit 1
Not sure we need to return an error return code in this case. A missing
compiler just means we skip the tests, not that we actually failed
anything.
> fi
> - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> + export CC="ccache gcc"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-gcc \
> + --cross-file $f
> done
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-19 1:37 ` [dpdk-dev] [PATCH v11 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 1/6] mk: fix makefile based cross build errors Gavin Hu
` (6 more replies)
6 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
5. v9 some minor changes to address the comments, as well some commit message refined.
a) move if clause out of the loop for a better program structure.
b) echo the correct ninja command actually used.
6. v10 Fix the whitespace issues.
7. v11 Shorten the command to a single line with all hardcoded values in order to be
shorter and more readable.
8. v12 Fix the following issues:
a) return directly instead exiting with an error, if cross gcc is missing, meaning
the cross compiling tests are skipped.
b) move the check for cross gcc presence ahead to cover the clang case
c) remove host-gcc from the build dir for brevity
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error
build: fix the meson cross compile error
devtools: expand meson cross compiling test coverage
gavin hu (2):
mk: fix makefile based cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 31 +++--
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 196 insertions(+), 11 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 1/6] mk: fix makefile based cross build errors
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 2/6] doc: add a guide doc for cross compiling from x86
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-24 11:43 ` Jerin Jacob
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 138 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..551f0aef8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
+ _aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section:
+ https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _argment_the_cross_toolcain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files to the cross compiler's include directory:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
+ -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
+ CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+ argmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+ EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
+ "-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+
+For example if the target machine is arm64 we can use the following
+command::
+ meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v12 2/6] doc: add a guide doc for cross compiling from x86
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-24 11:43 ` Jerin Jacob
0 siblings, 0 replies; 84+ messages in thread
From: Jerin Jacob @ 2018-06-24 11:43 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd
-----Original Message-----
> Date: Tue, 19 Jun 2018 18:36:53 +0800
> From: Gavin Hu <gavin.hu@arm.com>
> To: dev@dpdk.org
> CC: nd@arm.com, gavin.hu@arm.com
> Subject: [dpdk-dev] [PATCH v12 2/6] doc: add a guide doc for cross
> compiling from x86
> X-Mailer: git-send-email 2.11.0
>
>
> From: gavin hu <gavin.hu@arm.com>
>
> This is the guide for cross compiling ARM64 DPDK from X86 hosts.
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Steve Capper <Steve.Capper@arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
There is a build warning. Please check it
➜ [master][dpdk.org] $ make doc-guides-html
sphinx processing guides-html...
/export/dpdk.org/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst:133: WARNING: Unexpected indentation.
> ---
> .../linux_gsg/cross_build_dpdk_for_arm64.rst | 137 +++++++++++++++++++++
> doc/guides/linux_gsg/index.rst | 1 +
> 2 files changed, 138 insertions(+)
> create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
>
> diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> new file mode 100644
> index 000000000..551f0aef8
> --- /dev/null
> +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> @@ -0,0 +1,137 @@
> +.. SPDX-License-Identifier: BSD-3-Clause
> + Copyright(c) 2018 ARM Corporation.
> +
> +Cross compile DPDK for ARM64
> +============================
> +This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
> +
> +.. note::
> +
> + Whilst it is recommended to natively build DPDK on ARM64 (just
> + like with x86), it is also possible to cross-build DPDK for ARM64. An
> + ARM64 cross compile GNU toolchain is used for this.
> +
> +Obtain the cross tool chain
> +---------------------------
> +The latest cross compile tool chain can be downloaded from:
> +https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
A newline is better here for readability in rendered html file.
> +Following is the step to get the version 7.2.1, latest one at the time of this writing.
> +
> +.. code-block:: console
> +
> + wget 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
Please make this single line for easy access to URL in rendered html.
> +
> +Unzip and add into the PATH
> +---------------------------
> +
> +.. code-block:: console
> +
> + tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> + export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64
> + _aarch64-linux-gnu/bin
Please make this single line for easy access to URL in rendered html.
> +
> +.. note::
> +
> + For the host requirements and other info, refer to the release note section:
> + https://releases.linaro.org/components/toolchain/binaries/latest/
> +
> +Getting the prerequisite library
> +--------------------------------
> +
> +NUMA is required by most modern machines, not needed for non-NUMA architectures.
> +
> +.. note::
> +
> + For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
> + otherwise the compilation will fail with errors.
> +
> +.. code-block:: console
> +
> + git clone https://github.com/numactl/numactl.git
> + cd numactl
> + git checkout v2.0.11 -b v2.0.11
> + ./autogen.sh
> + autoconf -i
> + ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
> + make install
> +
> +The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
> +
> +.. _argment_the_cross_toolcain_with_numa_support:
s/toolchin/toolchain
> +
> +Augment the cross toolchain with NUMA support
> +---------------------------------------------
> +
> +.. note::
> +
> + This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
> +
> +Copy the NUMA header files to the cross compiler's include directory:
> +
> +.. code-block:: console
> +
> + cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11
> + -x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
Please make this single line for easy access in rendered html.
> + cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11
> + -x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
Please make this single line for easy access in rendered html.
> +
> +.. _configure_and_cross_compile_dpdk_build:
> +
> +Configure and cross compile DPDK Build
> +--------------------------------------
> +To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
> +
> +.. code-block:: console
> +
> + make config T=arm64-armv8a-linuxapp-gcc
> +
> +To cross-compile, without compiling the kernel modules, use the following command:
> +
> +.. code-block:: console
> +
> + make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
> +
> +To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
> +RTE_KERNELDIR:
> +
> +.. code-block:: console
> +
> + make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir>
> + CROSS_COMPILE=aarch64-linux-gnu-
> +
> +To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
> +
> +.. code-block:: console
> +
> + make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
> + CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
Please make this single line for easy access in rendered html.
> +
> +.. note::
> +
> + 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
> + if the above step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
s/toolcain/toolchain
> + argmented with NUMA support.
augmented??
> +
> + 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
> + errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
> +
> + An example is given below:
> +
> + .. code-block:: console
> +
> + make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
> + EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS=
> + "-L<numa_install_dir>/lib -lnuma"
Please make this single line for easy access in rendered html.
> +
> +Meson Cross Compiling DPDK
> +--------------------------
> +
> +To cross-compile DPDK on a desired target machine we can use the following
> +command::
> +
> + meson cross-build --cross-file <target_machine_configuration>
ninja -C cross-build
> +
> +For example if the target machine is arm64 we can use the following
> +command::
> + meson arm-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
s/arm-build/arm64-build??
ninja -C arm64-build/ step is missing.
> diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
> index 2a7bdfe92..077f93023 100644
> --- a/doc/guides/linux_gsg/index.rst
> +++ b/doc/guides/linux_gsg/index.rst
> @@ -13,6 +13,7 @@ Getting Started Guide for Linux
> intro
> sys_reqs
> build_dpdk
> + cross_build_dpdk_for_arm64
> linux_drivers
> build_sample_apps
> enable_func
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 3/6] build: fix the meson build warning
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-24 11:05 ` Jerin Jacob
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 4/6] devtools: fix the missing ninja command error Gavin Hu
` (3 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v12 3/6] build: fix the meson build warning
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-24 11:05 ` Jerin Jacob
0 siblings, 0 replies; 84+ messages in thread
From: Jerin Jacob @ 2018-06-24 11:05 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
-----Original Message-----
> Date: Tue, 19 Jun 2018 18:36:54 +0800
> From: Gavin Hu <gavin.hu@arm.com>
> To: dev@dpdk.org
> CC: nd@arm.com, gavin.hu@arm.com, stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v12 3/6] build: fix the meson build warning
> X-Mailer: git-send-email 2.11.0
>
>
> This is to fix the unnecessary warning output, it is not consistent with
> the configurations of other platforms.
>
> WARNING: Cross file does not specify strip binary, result will not be
> stripped.
>
> Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> config/arm/arm64_thunderx_linuxapp_gcc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
> index 7ff34af74..967d9d46d 100644
> --- a/config/arm/arm64_thunderx_linuxapp_gcc
> +++ b/config/arm/arm64_thunderx_linuxapp_gcc
> @@ -2,6 +2,7 @@
> c = 'aarch64-linux-gnu-gcc'
> cpp = 'aarch64-linux-gnu-cpp'
> ar = 'aarch64-linux-gnu-gcc-ar'
> +strip = 'aarch64-linux-gnu-strip'
>
> [host_machine]
> system = 'linux'
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 4/6] devtools: fix the missing ninja command error
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..9bb5b93bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -20,8 +29,8 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
unset CC
fi
- echo "ninja -C $builddir"
- ninja -C $builddir
+ echo "$ninja_cmd -C $builddir"
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 5/6] build: fix the meson cross compile error
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v12 6/6] devtools: expand meson cross compiling test coverage
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-19 10:36 ` Gavin Hu
2018-06-19 12:31 ` Bruce Richardson
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-19 10:36 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to increase the coverage by adding one more to cover
clang and the others for gcc.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
---
devtools/test-meson-builds.sh | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9bb5b93bd..e7db0abe9 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -45,10 +45,18 @@ done
build build-x86-default -Dmachine=nehalem
# enable cross compilation if gcc cross-compiler is found
+c=aarch64-linux-gnu-gcc
+if ! command -v $c >/dev/null 2>&1 ; then
+ echo "## ERROR: $c is missing, cross compiling is aborting..."
+ return
+fi
+
+# compile the general v8a also for clang to increase coverage
+export CC="ccache clang"
+build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
+
for f in config/arm/arm*gcc ; do
- c=aarch64-linux-gnu-gcc
- if ! command -v $c >/dev/null 2>&1 ; then
- continue
- fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \
+ --cross-file $f
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v12 6/6] devtools: expand meson cross compiling test coverage
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-19 12:31 ` Bruce Richardson
0 siblings, 0 replies; 84+ messages in thread
From: Bruce Richardson @ 2018-06-19 12:31 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd, stable
On Tue, Jun 19, 2018 at 06:36:57PM +0800, Gavin Hu wrote:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to increase the coverage by adding one more to cover
> clang and the others for gcc.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-19 10:36 ` [dpdk-dev] [PATCH v12 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors Gavin Hu
` (6 more replies)
6 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
5. v9 some minor changes to address the comments, as well some commit message refined.
a) move if clause out of the loop for a better program structure.
b) echo the correct ninja command actually used.
6. v10 Fix the whitespace issues.
7. v11 Shorten the command to a single line with all hardcoded values in order to be
shorter and more readable.
8. v12 Fix the following issues:
a) return directly instead exiting with an error, if cross gcc is missing, meaning
the cross compiling tests are skipped.
b) move the check for cross gcc presence ahead to cover the clang case
c) remove host-gcc from the build dir for brevity
9. v13 Fix the indention issue and merge lines to make the html doc more readable
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error
build: fix the meson cross compile error
devtools: expand meson cross compiling test coverage
gavin hu (2):
mk: fix makefile based cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 31 +++--
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 132 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 191 insertions(+), 11 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-25 16:10 ` Ali Alnubani
2018-06-27 21:00 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 2 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-25 16:10 ` Ali Alnubani
2018-06-27 21:00 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
1 sibling, 0 replies; 84+ messages in thread
From: Ali Alnubani @ 2018-06-25 16:10 UTC (permalink / raw)
To: 'Gavin Hu', 'dev@dpdk.org'
Cc: 'nd@arm.com', 'stable@dpdk.org'
Tested-by: Ali Alnubani <alialnu@mellanox.com>
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Gavin Hu
> Sent: Monday, June 25, 2018 5:49 AM
> To: dev@dpdk.org
> Cc: nd@arm.com; gavin.hu@arm.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors
>
> From: gavin hu <gavin.hu@arm.com>
>
> The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
> enabled when the cross compiler gcc is greater than 7.0, but for the host side
> buildtools/pmdinfogen, if the native gcc is older than 7.0, or the host cc
> compiler is clang, it should not be enabled.
>
> The fix is to differentiate the host gcc Werror options from the cross gcc.
>
> gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes -
> Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -
> Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual -Wformat-
> nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated -
> Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
> -I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
> ~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
> unrecognized command line option ‘-Wimplicit-fallthrough=2’
> ~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target
> 'pmdinfogen.o'
> failed make[3]: *** [pmdinfogen.o] Error 1
>
> Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Reviewed-by: Steve Capper <Steve.Capper@arm.com>
> ---
> buildtools/pmdinfogen/Makefile | 2 +-
> mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
> mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
> 3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/buildtools/pmdinfogen/Makefile
> b/buildtools/pmdinfogen/Makefile index bf07b6f2e..ff7a5fae6 100644
> --- a/buildtools/pmdinfogen/Makefile
> +++ b/buildtools/pmdinfogen/Makefile
> @@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen # SRCS-y +=
> pmdinfogen.c
>
> -HOST_CFLAGS += $(WERROR_FLAGS) -g
> +HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
> HOST_CFLAGS += -I$(RTE_OUTPUT)/include
>
> include $(RTE_SDK)/mk/rte.hostapp.mk
> diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk
> b/mk/toolchain/gcc/rte.toolchain-compat.mk
> index 255c89677..1e4434fa9 100644
> --- a/mk/toolchain/gcc/rte.toolchain-compat.mk
> +++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
> @@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ |
> $(CC) -E -x c - | tail -n 1) GCC_PATCHLEVEL = $(shell echo
> __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1) GCC_VERSION =
> $(GCC_MAJOR)$(GCC_MINOR)
>
> +HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n
> +1) HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x
> c - |
> +tail -n 1) HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ |
> +$(HOSTCC) -E -x c - | tail -n 1) HOST_GCC_VERSION =
> +$(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
> +
> # if GCC is older than 4.x
> ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
> MACHINE_CFLAGS =
> diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
> index 7e4531bab..d8b99faf6 100644
> --- a/mk/toolchain/gcc/rte.vars.mk
> +++ b/mk/toolchain/gcc/rte.vars.mk
> @@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
> WERROR_FLAGS += -Wno-uninitialized endif
>
> +HOST_WERROR_FLAGS := $(WERROR_FLAGS)
> +
> +ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1) # Tell GCC
> +only to error for switch fallthroughs without a suitable comment
> +HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2 # Ignore errors for
> +snprintf truncation HOST_WERROR_FLAGS += -Wno-format-truncation
> endif
> +
> ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1) # Tell GCC only to
> error for switch fallthroughs without a suitable comment WERROR_FLAGS +=
> -Wimplicit-fallthrough=2
> --
> 2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v13 1/6] mk: fix makefile based cross build errors
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-25 16:10 ` Ali Alnubani
@ 2018-06-27 21:00 ` Thomas Monjalon
1 sibling, 0 replies; 84+ messages in thread
From: Thomas Monjalon @ 2018-06-27 21:00 UTC (permalink / raw)
To: Gavin Hu; +Cc: stable, dev, nd
25/06/2018 04:49, Gavin Hu:
> From: gavin hu <gavin.hu@arm.com>
>
> The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
> enabled when the cross compiler gcc is greater than 7.0, but for the host
> side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
> host cc compiler is clang, it should not be enabled.
>
> The fix is to differentiate the host gcc Werror options from the cross gcc.
>
> gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
> -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
> -Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
> -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
> -Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
> -I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
> ~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
> unrecognized command line option ‘-Wimplicit-fallthrough=2’
> ~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
> failed make[3]: *** [pmdinfogen.o] Error 1
>
> Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross compiling from x86
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-27 14:25 ` Ali Alnubani
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 132 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 133 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..bad3d0288
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,132 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _augment_the_cross_toolchain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir> CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`augment_the_cross_toolchain_with_numa_support` was skipped therefore the toolchain was not
+ augmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS="-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+ ninja -C cross-build
+
+For example if the target machine is arm64 we can use the following
+command::
+
+ meson arm64-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
+ ninja -C arm64-build
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross compiling from x86
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-27 14:25 ` Ali Alnubani
2018-06-29 17:30 ` Gavin Hu
0 siblings, 1 reply; 84+ messages in thread
From: Ali Alnubani @ 2018-06-27 14:25 UTC (permalink / raw)
To: 'Gavin Hu', 'dev@dpdk.org'; +Cc: 'nd@arm.com'
Hi Gavin,
Thanks for documenting these steps.
Comments are inline.
> + cd numactl
> + git checkout v2.0.11 -b v2.0.11
> + ./autogen.sh
> + autoconf -i
> + ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa install
> dir>
>From ./configure -h:
"--host=HOST cross-compile to build programs to run on HOST [BUILD]"
Shouldn't it be aarch64-linux-gnu?
Also I think it would be safer to use '--' with prefix, since I think the configure script
might not throw an error for an invalid argument that doesn't start with '--'.
> + make install
> +
Regards,
Ali
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross compiling from x86
2018-06-27 14:25 ` Ali Alnubani
@ 2018-06-29 17:30 ` Gavin Hu
0 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:30 UTC (permalink / raw)
To: Ali Alnubani, 'dev@dpdk.org'; +Cc: nd
Hi Ali,
Thanks for your comments, I submitted the v14, please check if your comments are addressed and any more are welcome!
Best Regards,
Gavin
> -----Original Message-----
> From: Ali Alnubani <alialnu@mellanox.com>
> Sent: Wednesday, June 27, 2018 10:26 PM
> To: Gavin Hu <Gavin.Hu@arm.com>; 'dev@dpdk.org' <dev@dpdk.org>
> Cc: nd <nd@arm.com>
> Subject: RE: [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross
> compiling from x86
>
> Hi Gavin,
>
> Thanks for documenting these steps.
>
> Comments are inline.
>
> > + cd numactl
> > + git checkout v2.0.11 -b v2.0.11
> > + ./autogen.sh
> > + autoconf -i
> > + ./configure --host=x86_64 CC=aarch64-linux-gnu-gcc prefix=<numa
> > + install
> > dir>
>
> From ./configure -h:
> "--host=HOST cross-compile to build programs to run on HOST [BUILD]"
> Shouldn't it be aarch64-linux-gnu?
>
> Also I think it would be safer to use '--' with prefix, since I think the configure
> script might not throw an error for an invalid argument that doesn't start
> with '--'.
>
> > + make install
> > +
>
> Regards,
> Ali
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 3/6] build: fix the meson build warning
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-25 16:11 ` Ali Alnubani
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 4/6] devtools: fix the missing ninja command error Gavin Hu
` (3 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v13 3/6] build: fix the meson build warning
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-25 16:11 ` Ali Alnubani
0 siblings, 0 replies; 84+ messages in thread
From: Ali Alnubani @ 2018-06-25 16:11 UTC (permalink / raw)
To: 'Gavin Hu', 'dev@dpdk.org'
Cc: 'nd@arm.com', 'stable@dpdk.org'
Tested-by: Ali Alnubani <alialnu@mellanox.com>
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Gavin Hu
> Sent: Monday, June 25, 2018 5:49 AM
> To: dev@dpdk.org
> Cc: nd@arm.com; gavin.hu@arm.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v13 3/6] build: fix the meson build warning
>
> This is to fix the unnecessary warning output, it is not consistent with the
> configurations of other platforms.
>
> WARNING: Cross file does not specify strip binary, result will not be stripped.
>
> Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> config/arm/arm64_thunderx_linuxapp_gcc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/config/arm/arm64_thunderx_linuxapp_gcc
> b/config/arm/arm64_thunderx_linuxapp_gcc
> index 7ff34af74..967d9d46d 100644
> --- a/config/arm/arm64_thunderx_linuxapp_gcc
> +++ b/config/arm/arm64_thunderx_linuxapp_gcc
> @@ -2,6 +2,7 @@
> c = 'aarch64-linux-gnu-gcc'
> cpp = 'aarch64-linux-gnu-cpp'
> ar = 'aarch64-linux-gnu-gcc-ar'
> +strip = 'aarch64-linux-gnu-strip'
>
> [host_machine]
> system = 'linux'
> --
> 2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 4/6] devtools: fix the missing ninja command error
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-27 21:13 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..9bb5b93bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -20,8 +29,8 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
unset CC
fi
- echo "ninja -C $builddir"
- ninja -C $builddir
+ echo "$ninja_cmd -C $builddir"
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v13 4/6] devtools: fix the missing ninja command error
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-27 21:13 ` Thomas Monjalon
0 siblings, 0 replies; 84+ messages in thread
From: Thomas Monjalon @ 2018-06-27 21:13 UTC (permalink / raw)
To: Gavin Hu; +Cc: stable, dev, nd
25/06/2018 04:49, Gavin Hu:
> On some linux distributions, eg: CentOS, the ninja executable has a
> different name: ninja-build, this patch is to check and adapt to it
> accordingly.
>
> ./devtools/test-meson-builds.sh: line 24: ninja: command not found
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> +if command -v ninja >/dev/null 2>&1 ; then
> + ninja_cmd=ninja
> +elif command -v ninja-build >/dev/null 2>&1 ; then
> + ninja_cmd=ninja-build
> +else
> + echo "## ERROR: ninja is missing, please install..."
No need of double hash to get attention as it is the last printed line.
Matter of taste, but I prefer more simple (not interpreted) message like:
"ERROR: ninja is not found"
Or even simpler, no message at all and try with ninja_cmd=ninja as default:
if command -v ninja-build >/dev/null 2>&1 ; then
ninja_cmd=ninja-build
else
ninja_cmd=ninja
fi
Will still have the shell message in case of ninja not installed:
ninja: command not found
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 5/6] build: fix the meson cross compile error
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v13 6/6] devtools: expand meson cross compiling test coverage
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-25 2:49 ` Gavin Hu
2018-06-27 21:25 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-25 2:49 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to increase the coverage by adding one more to cover
clang and the others for gcc.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-meson-builds.sh | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9bb5b93bd..e7db0abe9 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -45,10 +45,18 @@ done
build build-x86-default -Dmachine=nehalem
# enable cross compilation if gcc cross-compiler is found
+c=aarch64-linux-gnu-gcc
+if ! command -v $c >/dev/null 2>&1 ; then
+ echo "## ERROR: $c is missing, cross compiling is aborting..."
+ return
+fi
+
+# compile the general v8a also for clang to increase coverage
+export CC="ccache clang"
+build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
+
for f in config/arm/arm*gcc ; do
- c=aarch64-linux-gnu-gcc
- if ! command -v $c >/dev/null 2>&1 ; then
- continue
- fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \
+ --cross-file $f
done
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v13 6/6] devtools: expand meson cross compiling test coverage
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-27 21:25 ` Thomas Monjalon
2018-06-29 17:29 ` Gavin Hu
0 siblings, 1 reply; 84+ messages in thread
From: Thomas Monjalon @ 2018-06-27 21:25 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd
Hi,
25/06/2018 04:49, Gavin Hu:
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> # enable cross compilation if gcc cross-compiler is found
> +c=aarch64-linux-gnu-gcc
> +if ! command -v $c >/dev/null 2>&1 ; then
> + echo "## ERROR: $c is missing, cross compiling is aborting..."
Not having a cross compiler should not be an error.
> + return
Please, no return, because we could add more compilation tests below,
including other cross-compilations.
> +fi
> +
> +# compile the general v8a also for clang to increase coverage
> +export CC="ccache clang"
> +build build-arm64-host-clang --cross-file config/arm/arm64_armv8_linuxapp_gcc
> +
> for f in config/arm/arm*gcc ; do
> - c=aarch64-linux-gnu-gcc
> - if ! command -v $c >/dev/null 2>&1 ; then
> - continue
> - fi
> - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> + export CC="ccache gcc"
> + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \
> + --cross-file $f
> done
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v13 6/6] devtools: expand meson cross compiling test coverage
2018-06-27 21:25 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
@ 2018-06-29 17:29 ` Gavin Hu
0 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:29 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, nd
Hi Thomas,
I submitted the v14 patch set to address your two comments!
Any more comments are welcome!
Best Regards,
Gavin
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday, June 28, 2018 5:26 AM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>
> Subject: Re: [dpdk-stable] [PATCH v13 6/6] devtools: expand meson cross
> compiling test coverage
>
> Hi,
>
> 25/06/2018 04:49, Gavin Hu:
> > --- a/devtools/test-meson-builds.sh
> > +++ b/devtools/test-meson-builds.sh
> > # enable cross compilation if gcc cross-compiler is found
> > +c=aarch64-linux-gnu-gcc
> > +if ! command -v $c >/dev/null 2>&1 ; then
> > + echo "## ERROR: $c is missing, cross compiling is aborting..."
>
> Not having a cross compiler should not be an error.
>
> > + return
>
> Please, no return, because we could add more compilation tests below,
> including other cross-compilations.
>
> > +fi
> > +
> > +# compile the general v8a also for clang to increase coverage export
> > +CC="ccache clang"
> > +build build-arm64-host-clang --cross-file
> > +config/arm/arm64_armv8_linuxapp_gcc
> > +
> > for f in config/arm/arm*gcc ; do
> > - c=aarch64-linux-gnu-gcc
> > - if ! command -v $c >/dev/null 2>&1 ; then
> > - continue
> > - fi
> > - build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
> > + export CC="ccache gcc"
> > + build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \
> > + --cross-file $f
> > done
>
>
>
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-25 2:49 ` [dpdk-dev] [PATCH v13 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 1/6] mk: fix makefile based cross build errors Gavin Hu
` (6 more replies)
6 siblings, 7 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
1. Pre-v5 of this patch set(two patches) is to fix the GNU Makefile based cross
compiling errors and add a guiding doc for this.
2. v6 add 5 more new patches to cover meson cross fixes
3. v7 Some minor changes to address the comments:
a) trim the commit message
b) at the start of the script, test ninja or ninja-build and use it to work out
the command to work out.
c) use host gcc and clang for the general v8a only to avoid overkill, and use gcc
for others.
4. v8 drop one of the new patch as it a similar fix was already upstreamed
5. v9 some minor changes to address the comments, as well some commit message refined.
a) move if clause out of the loop for a better program structure.
b) echo the correct ninja command actually used.
6. v10 Fix the whitespace issues.
7. v11 Shorten the command to a single line with all hardcoded values in order to be
shorter and more readable.
8. v12 Fix the following issues:
a) return directly instead exiting with an error, if cross gcc is missing, meaning
the cross compiling tests are skipped.
b) move the check for cross gcc presence ahead to cover the clang case.
c) remove host-gcc from the build dir for brevity.
9. v13 Fix the indention issue and merge lines to make the html doc more readable.
10. v14 Fix the following issues:
a) remove the double hash to get attention for ninja
b) cross compile only if the cross compiler is installed, just skip and no errors
output for this if not installed.
c) fix the errors with the building steps for numactl.
Gavin Hu (4):
build: fix the meson build warning
devtools: fix the missing ninja command error
build: fix the meson cross compile error
devtools: expand meson cross compiling test coverage
gavin hu (2):
mk: fix makefile based cross build errors
doc: add a guide doc for cross compiling from x86
buildtools/pmdinfogen/Makefile | 2 +-
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
config/meson.build | 3 +-
devtools/test-meson-builds.sh | 33 ++++--
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 132 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
drivers/meson.build | 3 +
examples/meson.build | 4 +
lib/meson.build | 4 +
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +
mk/toolchain/gcc/rte.vars.mk | 9 ++
test/test/meson.build | 7 +-
12 files changed, 191 insertions(+), 13 deletions(-)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 1/6] mk: fix makefile based cross build errors
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
` (5 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
From: gavin hu <gavin.hu@arm.com>
The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it was
enabled when the cross compiler gcc is greater than 7.0, but for the host
side buildtools/pmdinfogen, if the native gcc is older than 7.0, or the
host cc compiler is clang, it should not be enabled.
The fix is to differentiate the host gcc Werror options from the cross gcc.
gcc -Wp,-MD,./.pmdinfogen.o.d.tmp -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
-Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated
-Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
-I/home/gavin/arm_repo/dpdk/build/include -o pmdinfogen.o -c
~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
unrecognized command line option ‘-Wimplicit-fallthrough=2’
~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
failed make[3]: *** [pmdinfogen.o] Error 1
Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Tested-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
buildtools/pmdinfogen/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 5 +++++
mk/toolchain/gcc/rte.vars.mk | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f2e..ff7a5fae6 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -41,7 +41,7 @@ HOSTAPP = dpdk-pmdinfogen
#
SRCS-y += pmdinfogen.c
-HOST_CFLAGS += $(WERROR_FLAGS) -g
+HOST_CFLAGS += $(HOST_WERROR_FLAGS) -g
HOST_CFLAGS += -I$(RTE_OUTPUT)/include
include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 255c89677..1e4434fa9 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -15,6 +15,11 @@ GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
+HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
+HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
+
# if GCC is older than 4.x
ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
MACHINE_CFLAGS =
diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531bab..d8b99faf6 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -71,6 +71,15 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
+HOST_WERROR_FLAGS := $(WERROR_FLAGS)
+
+ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)
+# Tell GCC only to error for switch fallthroughs without a suitable comment
+HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2
+# Ignore errors for snprintf truncation
+HOST_WERROR_FLAGS += -Wno-format-truncation
+endif
+
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
# Tell GCC only to error for switch fallthroughs without a suitable comment
WERROR_FLAGS += -Wimplicit-fallthrough=2
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 2/6] doc: add a guide doc for cross compiling from x86
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 1/6] mk: fix makefile based cross build errors Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 3/6] build: fix the meson build warning Gavin Hu
` (4 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu
From: gavin hu <gavin.hu@arm.com>
This is the guide for cross compiling ARM64 DPDK from X86 hosts.
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
.../linux_gsg/cross_build_dpdk_for_arm64.rst | 132 +++++++++++++++++++++
doc/guides/linux_gsg/index.rst | 1 +
2 files changed, 133 insertions(+)
create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
new file mode 100644
index 000000000..9d1f0fa00
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,132 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2018 ARM Corporation.
+
+Cross compile DPDK for ARM64
+============================
+This chapter describes how to cross compile DPDK for ARM64 from x86 build hosts.
+
+.. note::
+
+ Whilst it is recommended to natively build DPDK on ARM64 (just
+ like with x86), it is also possible to cross-build DPDK for ARM64. An
+ ARM64 cross compile GNU toolchain is used for this.
+
+Obtain the cross tool chain
+---------------------------
+The latest cross compile tool chain can be downloaded from:
+https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/.
+
+Following is the step to get the version 7.2.1, latest one at the time of this writing.
+
+.. code-block:: console
+
+ wget 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
+
+Unzip and add into the PATH
+---------------------------
+
+.. code-block:: console
+
+ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+ export PATH=$PATH:<cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
+
+.. note::
+
+ For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/latest/
+
+Getting the prerequisite library
+--------------------------------
+
+NUMA is required by most modern machines, not needed for non-NUMA architectures.
+
+.. note::
+
+ For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
+ otherwise the compilation will fail with errors.
+
+.. code-block:: console
+
+ git clone https://github.com/numactl/numactl.git
+ cd numactl
+ git checkout v2.0.11 -b v2.0.11
+ ./autogen.sh
+ autoconf -i
+ ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=<numa install dir>
+ make install
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+.. _augment_the_cross_toolchain_with_numa_support:
+
+Augment the cross toolchain with NUMA support
+---------------------------------------------
+
+.. note::
+
+ This way is optional, an alternative is to use extra CFLAGS and LDFLAGS, depicted in :ref:`configure_and_cross_compile_dpdk_build` below.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
+
+.. code-block:: console
+
+ cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+ cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+.. _configure_and_cross_compile_dpdk_build:
+
+Configure and cross compile DPDK Build
+--------------------------------------
+To configure a build, choose one of the target configurations, like arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc.
+
+.. code-block:: console
+
+ make config T=arm64-armv8a-linuxapp-gcc
+
+To cross-compile, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile, including the kernel modules, the kernel source tree needs to be specified by setting
+RTE_KERNELDIR:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir> CROSS_COMPILE=aarch64-linux-gnu-
+
+To compile for non-NUMA targets, without compiling the kernel modules, use the following command:
+
+.. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+
+.. note::
+
+ 1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
+ if the above step :ref:`augment_the_cross_toolchain_with_numa_support` was skipped therefore the toolchain was not
+ augmented with NUMA support.
+
+ 2. "-isystem <numa_install_dir>/include" should be add to EXTRA_CFLAGS, otherwise the numa.h file will get a lot of compiling
+ errors of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition.
+
+ An example is given below:
+
+ .. code-block:: console
+
+ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n EXTRA_CFLAGS="-isystem <numa_install_dir>/include" EXTRA_LDFLAGS="-L<numa_install_dir>/lib -lnuma"
+
+Meson Cross Compiling DPDK
+--------------------------
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+ meson cross-build --cross-file <target_machine_configuration>
+ ninja -C cross-build
+
+For example if the target machine is arm64 we can use the following
+command::
+
+ meson arm64-build --cross-file config/arm/arm64_armv8_linuxapp_gcc
+ ninja -C arm64-build
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe92..077f93023 100644
--- a/doc/guides/linux_gsg/index.rst
+++ b/doc/guides/linux_gsg/index.rst
@@ -13,6 +13,7 @@ Getting Started Guide for Linux
intro
sys_reqs
build_dpdk
+ cross_build_dpdk_for_arm64
linux_drivers
build_sample_apps
enable_func
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 3/6] build: fix the meson build warning
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 1/6] mk: fix makefile based cross build errors Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 2/6] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 4/6] devtools: fix the missing ninja command error Gavin Hu
` (3 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
This is to fix the unnecessary warning output, it is not consistent with
the configurations of other platforms.
WARNING: Cross file does not specify strip binary, result will not be
stripped.
Fixes: e53a5299d2 ("build: support vendor specific ARM cross builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Ali Alnubani <alialnu@mellanox.com>
---
config/arm/arm64_thunderx_linuxapp_gcc | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 7ff34af74..967d9d46d 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -2,6 +2,7 @@
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-cpp'
ar = 'aarch64-linux-gnu-gcc-ar'
+strip = 'aarch64-linux-gnu-strip'
[host_machine]
system = 'linux'
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 4/6] devtools: fix the missing ninja command error
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
` (2 preceding siblings ...)
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 3/6] build: fix the meson build warning Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 5/6] build: fix the meson cross compile error Gavin Hu
` (2 subsequent siblings)
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.
./devtools/test-meson-builds.sh: line 24: ninja: command not found
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-meson-builds.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2ad05f32..9bb5b93bd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -10,6 +10,15 @@
srcdir=$(dirname $(readlink -m $0))/..
MESON=${MESON:-meson}
+if command -v ninja >/dev/null 2>&1 ; then
+ ninja_cmd=ninja
+elif command -v ninja-build >/dev/null 2>&1 ; then
+ ninja_cmd=ninja-build
+else
+ echo "## ERROR: ninja is missing, please install..."
+ exit 1
+fi
+
build () # <directory> <meson options>
{
builddir=$1
@@ -20,8 +29,8 @@ build () # <directory> <meson options>
$MESON $options $srcdir $builddir
unset CC
fi
- echo "ninja -C $builddir"
- ninja -C $builddir
+ echo "$ninja_cmd -C $builddir"
+ $ninja_cmd -C $builddir
}
# shared and static linked builds with gcc and clang
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 5/6] build: fix the meson cross compile error
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
` (3 preceding siblings ...)
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 4/6] devtools: fix the missing ninja command error Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
2018-07-11 19:16 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Thomas Monjalon
6 siblings, 0 replies; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The following error hits if host cc compiler is clang(default one in most
linux distributions) and the cross compiler is gcc.
The root cause is: the hybride compilers add the warning options to the
meson project as project arguments, which apply for both host compiling and
cross compiling. But some options such as '-Wno-format-truncation' are not
supported nor recognized by clang, so they have to be removed from the
project arguments for the host compiler to run smoothily and added back as
cflags for the cross compiler to compile for cross source files.
The fix is remove unrecognized warning options from the meson project
arguments shared by gcc and clang, as add them specifically for gcc or
clang as cflags.
[265/893] Compiling C object
'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown
warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/meson.build | 3 +--
drivers/meson.build | 3 +++
examples/meson.build | 4 ++++
lib/meson.build | 4 ++++
test/test/meson.build | 7 ++++++-
5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 50081b572..272d4a838 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -57,8 +57,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
warning_flags = [
'-Wsign-compare',
'-Wcast-qual',
- '-Wno-address-of-packed-member',
- '-Wno-format-truncation'
+ '-Wno-address-of-packed-member'
]
foreach arg: warning_flags
if cc.has_argument(arg)
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c97297..1737d86b8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/examples/meson.build b/examples/meson.build
index 3d1568497..e6558875a 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -24,6 +24,10 @@ foreach example: examples
sources = []
allow_experimental_apis = false
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
ext_deps = [execinfo]
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index 9d11571f9..fefb3605d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,6 +34,10 @@ foreach l:libraries
headers = []
includes = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
+
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/test/test/meson.build b/test/test/meson.build
index a907fd256..dc4ba5514 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -235,6 +235,11 @@ if dpdk_conf.has('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
@@ -260,7 +265,7 @@ if get_option('tests')
test_sources,
link_whole: link_libs,
dependencies: test_dep_objs,
- c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
install_rpath: driver_install_path,
install: false)
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* [dpdk-dev] [PATCH v14 6/6] devtools: expand meson cross compiling test coverage
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
` (4 preceding siblings ...)
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 5/6] build: fix the meson cross compile error Gavin Hu
@ 2018-06-29 17:27 ` Gavin Hu
2018-07-11 17:46 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-07-11 19:16 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Thomas Monjalon
6 siblings, 1 reply; 84+ messages in thread
From: Gavin Hu @ 2018-06-29 17:27 UTC (permalink / raw)
To: dev; +Cc: nd, gavin.hu, stable
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to increase the coverage by adding one more to cover
clang and the others for gcc.
Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-meson-builds.sh | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9bb5b93bd..f38304e6e 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -15,7 +15,7 @@ if command -v ninja >/dev/null 2>&1 ; then
elif command -v ninja-build >/dev/null 2>&1 ; then
ninja_cmd=ninja-build
else
- echo "## ERROR: ninja is missing, please install..."
+ echo "ERROR: ninja is not found"
exit 1
fi
@@ -45,10 +45,16 @@ done
build build-x86-default -Dmachine=nehalem
# enable cross compilation if gcc cross-compiler is found
-for f in config/arm/arm*gcc ; do
- c=aarch64-linux-gnu-gcc
- if ! command -v $c >/dev/null 2>&1 ; then
- continue
- fi
- build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
-done
+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="ccache clang"
+ build build-arm64-host-clang --cross-file \
+ config/arm/arm64_armv8_linuxapp_gcc
+
+ for f in config/arm/arm*gcc ; do
+ export CC="ccache gcc"
+ build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \
+ --cross-file $f
+ done
+fi
--
2.11.0
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v14 6/6] devtools: expand meson cross compiling test coverage
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-07-11 17:46 ` Thomas Monjalon
0 siblings, 0 replies; 84+ messages in thread
From: Thomas Monjalon @ 2018-07-11 17:46 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd
29/06/2018 19:27, Gavin Hu:
> The default test script covers only default host cc compiler, either gcc or
> clang, the fix is to increase the coverage by adding one more to cover
> clang and the others for gcc.
>
> Fixes: a55277a788 ("devtools: add test script for meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Song Zhu <song.zhu@arm.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> devtools/test-meson-builds.sh | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9bb5b93bd..f38304e6e 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -15,7 +15,7 @@ if command -v ninja >/dev/null 2>&1 ; then
> elif command -v ninja-build >/dev/null 2>&1 ; then
> ninja_cmd=ninja-build
> else
> - echo "## ERROR: ninja is missing, please install..."
> + echo "ERROR: ninja is not found"
This is changing a (not related) line introduced in patch 4.
I will squash myself if no other error is found.
^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 0/6] Fix the cross compiling errors Gavin Hu
` (5 preceding siblings ...)
2018-06-29 17:27 ` [dpdk-dev] [PATCH v14 6/6] devtools: expand meson cross compiling test coverage Gavin Hu
@ 2018-07-11 19:16 ` Thomas Monjalon
6 siblings, 0 replies; 84+ messages in thread
From: Thomas Monjalon @ 2018-07-11 19:16 UTC (permalink / raw)
To: Gavin Hu; +Cc: dev, nd
29/06/2018 19:27, Gavin Hu:
> Gavin Hu (4):
> build: fix the meson build warning
> devtools: fix the missing ninja command error
> build: fix the meson cross compile error
> devtools: expand meson cross compiling test coverage
>
> gavin hu (2):
> mk: fix makefile based cross build errors
> doc: add a guide doc for cross compiling from x86
Applied with minor changes (names and error message), thanks
^ permalink raw reply [flat|nested] 84+ messages in thread