From patchwork Fri Jun 29 17:27:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 41981 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6C8F41B6E9; Fri, 29 Jun 2018 19:27:58 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 6B4761B05F; Fri, 29 Jun 2018 19:27:53 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C00A218A; Fri, 29 Jun 2018 10:27:52 -0700 (PDT) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0C5773F5AD; Fri, 29 Jun 2018 10:27:51 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, gavin.hu@arm.com, stable@dpdk.org Date: Sat, 30 Jun 2018 01:27:33 +0800 Message-Id: <20180629172738.2121-2-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180629172738.2121-1-gavin.hu@arm.com> References: <20180625024913.17219-1-gavin.hu@arm.com> <20180629172738.2121-1-gavin.hu@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v14 1/6] mk: fix makefile based cross build errors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: gavin hu 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 Reviewed-by: Honnappa Nagarahalli Reviewed-by: Steve Capper Tested-by: Ali Alnubani Acked-by: Thomas Monjalon --- 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 From patchwork Fri Jun 29 17:27:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 41982 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA0C61B75D; Fri, 29 Jun 2018 19:27:59 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 31F1C1B05F for ; Fri, 29 Jun 2018 19:27:54 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95B121529; Fri, 29 Jun 2018 10:27:53 -0700 (PDT) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 055EF3F5AD; Fri, 29 Jun 2018 10:27:52 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, gavin.hu@arm.com Date: Sat, 30 Jun 2018 01:27:34 +0800 Message-Id: <20180629172738.2121-3-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180629172738.2121-1-gavin.hu@arm.com> References: <20180625024913.17219-1-gavin.hu@arm.com> <20180629172738.2121-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v14 2/6] doc: add a guide doc for cross compiling from x86 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: gavin hu This is the guide for cross compiling ARM64 DPDK from X86 hosts. Signed-off-by: Gavin Hu Reviewed-by: Steve Capper Reviewed-by: Honnappa Nagarahalli Acked-by: Marko Kovacevic --- .../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:/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= + make install + +The numa header files and lib file is generated in the include and lib folder respectively under . + +.. _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 /include/numa*.h /gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/ + cp /lib/libnuma.a /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= 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 /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 /include" EXTRA_LDFLAGS="-L/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 + 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 From patchwork Fri Jun 29 17:27:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 41983 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D0831B87B; Fri, 29 Jun 2018 19:28:02 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 20FAF1B05F; Fri, 29 Jun 2018 19:27:55 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D97615AD; Fri, 29 Jun 2018 10:27:54 -0700 (PDT) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CFA3C3F5AD; Fri, 29 Jun 2018 10:27:53 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, gavin.hu@arm.com, stable@dpdk.org Date: Sat, 30 Jun 2018 01:27:35 +0800 Message-Id: <20180629172738.2121-4-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180629172738.2121-1-gavin.hu@arm.com> References: <20180625024913.17219-1-gavin.hu@arm.com> <20180629172738.2121-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v14 3/6] build: fix the meson build warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Phil Yang Reviewed-by: Song Zhu Acked-by: Bruce Richardson Acked-by: Jerin Jacob Tested-by: Ali Alnubani --- 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' From patchwork Fri Jun 29 17:27:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 41984 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 54DB11B8B9; Fri, 29 Jun 2018 19:28:04 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 133F91B05F; Fri, 29 Jun 2018 19:27:56 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 837181529; Fri, 29 Jun 2018 10:27:55 -0700 (PDT) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C7BF23F5AD; Fri, 29 Jun 2018 10:27:54 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, gavin.hu@arm.com, stable@dpdk.org Date: Sat, 30 Jun 2018 01:27:36 +0800 Message-Id: <20180629172738.2121-5-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180629172738.2121-1-gavin.hu@arm.com> References: <20180625024913.17219-1-gavin.hu@arm.com> <20180629172738.2121-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v14 4/6] devtools: fix the missing ninja command error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Phil Yang Reviewed-by: Song Zhu Acked-by: Bruce Richardson --- 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 () # { builddir=$1 @@ -20,8 +29,8 @@ build () # $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 From patchwork Fri Jun 29 17:27:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 41985 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88A501B8C2; Fri, 29 Jun 2018 19:28:06 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 14E441B6E9; Fri, 29 Jun 2018 19:27:57 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7ABDF18A; Fri, 29 Jun 2018 10:27:56 -0700 (PDT) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BD3353F5AD; Fri, 29 Jun 2018 10:27:55 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, gavin.hu@arm.com, stable@dpdk.org Date: Sat, 30 Jun 2018 01:27:37 +0800 Message-Id: <20180629172738.2121-6-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180629172738.2121-1-gavin.hu@arm.com> References: <20180625024913.17219-1-gavin.hu@arm.com> <20180629172738.2121-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v14 5/6] build: fix the meson cross compile error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Phil Yang Reviewed-by: Song Zhu Reviewed-by: Steve Capper Acked-by: Bruce Richardson --- 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) From patchwork Fri Jun 29 17:27:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 41986 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B62FC1B8C9; Fri, 29 Jun 2018 19:28:08 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 08D751B69B; Fri, 29 Jun 2018 19:27:58 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 70D6F1529; Fri, 29 Jun 2018 10:27:57 -0700 (PDT) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B42393F5AD; Fri, 29 Jun 2018 10:27:56 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, gavin.hu@arm.com, stable@dpdk.org Date: Sat, 30 Jun 2018 01:27:38 +0800 Message-Id: <20180629172738.2121-7-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180629172738.2121-1-gavin.hu@arm.com> References: <20180625024913.17219-1-gavin.hu@arm.com> <20180629172738.2121-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v14 6/6] devtools: expand meson cross compiling test coverage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Phil Yang Reviewed-by: Song Zhu Acked-by: Bruce Richardson --- 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