DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] *** gcc cross compile dpdk ***
@ 2018-05-24  3:38 Gavin Hu
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 1/2] mk: fix cross build errors Gavin Hu
                   ` (2 more replies)
  0 siblings, 3 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-24  3:38 UTC (permalink / raw)
  To: dev

*** gcc cross compile dpdk, including a fix and a doc ***

Gavin Hu (2):
  mk: fix cross build errors
  doc: add a guide doc for cross compiling from x86

 buildtools/pmdinfogen/Makefile           |  2 +-
 doc/cross_compiling_sdk.txt              | 58 ++++++++++++++++++++++++++++++++
 mk/toolchain/gcc/rte.toolchain-compat.mk |  5 +++
 mk/toolchain/gcc/rte.vars.mk             |  9 +++++
 4 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 doc/cross_compiling_sdk.txt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH 1/2] mk: fix cross build errors
  2018-05-24  3:38 [dpdk-dev] [PATCH 0/2] *** gcc cross compile dpdk *** Gavin Hu
@ 2018-05-24  3:38 ` Gavin Hu
  2018-05-24 13:46   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-28  6:53 ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Gavin Hu
  2 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-05-24  3:38 UTC (permalink / raw)
  To: dev; +Cc: stable

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 is older than 7.0, 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 bf07b6f..ff7a5fa 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 255c896..1e4434f 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 7e4531b..d9a4e09 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 $(USE_HOST) -e 1 && 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.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24  3:38 [dpdk-dev] [PATCH 0/2] *** gcc cross compile dpdk *** Gavin Hu
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 1/2] mk: fix cross build errors Gavin Hu
@ 2018-05-24  3:38 ` Gavin Hu
  2018-05-24 10:45   ` Kovacevic, Marko
  2018-05-24 11:17   ` Jerin Jacob
  2018-05-28  6:53 ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Gavin Hu
  2 siblings, 2 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-24  3:38 UTC (permalink / raw)
  To: dev

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>
---
 doc/cross_compiling_sdk.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 doc/cross_compiling_sdk.txt

diff --git a/doc/cross_compiling_sdk.txt b/doc/cross_compiling_sdk.txt
new file mode 100644
index 0000000..aa08871
--- /dev/null
+++ b/doc/cross_compiling_sdk.txt
@@ -0,0 +1,58 @@
+How to cross compile DPDK for ARM64
+-----------------------------------
+
+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, which currently requires
+the NUMA libraries to be integrated. Following are the steps to follow.
+
+1. 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 so far.
+$ 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
+
+2. Unzip and add into the PATH
+------------------------------
+$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+$ export PATH=$PATH:<install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
+Note: For the host requirements and ohter info, refer to the release note section:
+https://releases.linaro.org/components/toolchain/binaries/latest/
+
+3. Getting the prerequisite library
+-----------------------------------
+-- NUMA
+--Prequisite: make sure the installed libtool version >= 2.2(run libtool --version to check),
+otherwise the compilation will fail with errors.
+$ 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
+$ make
+
+4. Install the numa header and lib
+----------------------------------
+Copy the header files to the cross compiler's include directory:
+$ cp numa*.h <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+Copy the numa lib to the cross compiler;s lib directory:
+$ cp .libs/libnuma.a <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+5. Configuring the DPDK Build
+-----------------------------
+To configure a build, follow the build-sdk-quick.txt file to select the target
+configuration.
+$ make config T=arm64-armv8a-linuxapp-gcc
+
+6. Cross Compiling DPDK
+-----------------------
+To cross-compile DPDK for ARM64 target machine, without compiling the kernel modules, use the following
+command:
+$ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile DPDK for ARM64, including the kernel modules, the kernel source tree is required.
+Set RTE_KERNEL_SRC_ROOTDIR to the kernel source tree folder and use the following command:
+$ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=KERNEL_SRC_ROOTDIR CROSS_COMPILE=aarch64-linux-gnu-
-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-24 10:45   ` Kovacevic, Marko
  2018-05-24 10:47     ` Kovacevic, Marko
  2018-05-24 11:17   ` Jerin Jacob
  1 sibling, 1 reply; 59+ messages in thread
From: Kovacevic, Marko @ 2018-05-24 10:45 UTC (permalink / raw)
  To: Gavin Hu, dev

> 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>
> ---
>  doc/cross_compiling_sdk.txt | 58
> +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 58 insertions(+)
>  create mode 100644 doc/cross_compiling_sdk.txt
>

 
<...>

> +
> +2. Unzip and add into the PATH
> +------------------------------
> +$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> +$ export PATH=$PATH:<install
> +dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
> +Note: For the host requirements and ohter info, refer to the release note
> section:

Spelling:  other / other

> +https://releases.linaro.org/components/toolchain/binaries/latest/
> +
> +3. Getting the prerequisite library
> +-----------------------------------
> +-- NUMA
> +--Prequisite: make sure the installed libtool version >= 2.2(run

Spelling: Prequisite /  Prerequisite

<...>

> +4. Install the numa header and lib
> +----------------------------------

Make numa / NUMA above

> +Copy the header files to the cross compiler's include directory:
> +$ cp numa*.h <install
> +dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-l
> +inux-gnu/libc/usr/include/ Copy the numa lib to the cross compiler;s
> +lib directory:

Copy numa / Copy NUMA

cross compiler;s  / compilers


<...>

Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24 10:45   ` Kovacevic, Marko
@ 2018-05-24 10:47     ` Kovacevic, Marko
  0 siblings, 0 replies; 59+ messages in thread
From: Kovacevic, Marko @ 2018-05-24 10:47 UTC (permalink / raw)
  To: Kovacevic, Marko, Gavin Hu, dev

Auto spell corrected my text

Spelling:  ohter / other

> > +2. Unzip and add into the PATH
> > +------------------------------
> > +$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> > +$ export PATH=$PATH:<install
> > +dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
> > +Note: For the host requirements and ohter info, refer to the release
> > +note
> > section:
> 
> Spelling:  other / other

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-24 10:45   ` Kovacevic, Marko
@ 2018-05-24 11:17   ` Jerin Jacob
  2018-05-24 13:20     ` Bruce Richardson
  2018-05-24 13:54     ` Thomas Monjalon
  1 sibling, 2 replies; 59+ messages in thread
From: Jerin Jacob @ 2018-05-24 11:17 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev

-----Original Message-----
> Date: Wed, 23 May 2018 23:38:47 -0400
> From: Gavin Hu <gavin.hu@arm.com>
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling
>  from x86
> X-Mailer: git-send-email 2.1.4
> 
> 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>

In addition to comments from Marko,

> ---
>  doc/cross_compiling_sdk.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++

I think, instead of keeping it as a orphan document, IMO, it should linked with
https://dpdk.org/doc/guides/
I think, it can go a new section or "HowTo Guides" section, So that in future armv7 and/or PowerPC cross
compilation details can be added.


>  1 file changed, 58 insertions(+)
>  create mode 100644 doc/cross_compiling_sdk.txt
> 
> diff --git a/doc/cross_compiling_sdk.txt b/doc/cross_compiling_sdk.txt
> new file mode 100644
> index 0000000..aa08871
> --- /dev/null
> +++ b/doc/cross_compiling_sdk.txt
> @@ -0,0 +1,58 @@
> +How to cross compile DPDK for ARM64
> +-----------------------------------
> +
> +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, which currently requires
> +the NUMA libraries to be integrated. Following are the steps to follow.
> +
> +1. 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 so far.
> +$ 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
> +
> +2. Unzip and add into the PATH
> +------------------------------
> +$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> +$ export PATH=$PATH:<install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
> +Note: For the host requirements and ohter info, refer to the release note section:
> +https://releases.linaro.org/components/toolchain/binaries/latest/
> +
> +3. Getting the prerequisite library
> +-----------------------------------
> +-- NUMA
> +--Prequisite: make sure the installed libtool version >= 2.2(run libtool --version to check),
> +otherwise the compilation will fail with errors.
> +$ 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
> +$ make
> +
> +4. Install the numa header and lib
> +----------------------------------
> +Copy the header files to the cross compiler's include directory:
> +$ cp numa*.h <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
> +Copy the numa lib to the cross compiler;s lib directory:
> +$ cp .libs/libnuma.a <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/

Installing numactrl header files and library files to toolchain area
does not looks very correct. IMO, You can use --prefix option in
numactrl to install to separate directory and add the include details through
EXTRA_CFLAGS and EXTRA_LDFLAGS. This will help in meson for pkg-config
related case as well.

> +
> +5. Configuring the DPDK Build
> +-----------------------------
> +To configure a build, follow the build-sdk-quick.txt file to select the target
> +configuration.
> +$ make config T=arm64-armv8a-linuxapp-gcc

IMO, You can mentioned about other armv8 target such as
defconfig_arm64-dpaa2-linuxapp-gcc/defconfig_arm64-thunderx-linuxapp-gcc
for optimized build specific to target.

> +
> +6. Cross Compiling DPDK
> +-----------------------
> +To cross-compile DPDK for ARM64 target machine, without compiling the kernel modules, use the following
> +command:
> +$ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n

I think, you could mention to set CONFIG_RTE_LIBRTE_VHOST_NUMA=n and
CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n for NON numa systems to avoid
building numactl for single node systems.

> +
> +To cross-compile DPDK for ARM64, including the kernel modules, the kernel source tree is required.
> +Set RTE_KERNEL_SRC_ROOTDIR to the kernel source tree folder and use the following command:
> +$ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=KERNEL_SRC_ROOTDIR CROSS_COMPILE=aarch64-linux-gnu-

You could add meson cross build details too.

export MESON_PARAMS='-Dwerror=true
-Dexamples=bond,bbdev_app,cmdline,distributor,eventdev_pipeline,exception_path,flow_classify,flow_filtering,helloworld,ip_fragmentation,ip_pipeline,ip_reassembly,ipsec-secgw,ipv4_multicast,kni,l2fwd,l2fwd-crypto,l2fwd-jobstats,l2fwd-keepalive,l3fwd,l3fwd-acl,l3fwd-power,l3fwd-vf,link_status_interrupt,load_balancer,packet_ordering,ptpclient,qos_meter,qos_sched,rxtx_callbacks,service_cores,skeleton,tep_termination,timer,vhost,vhost_scsi,vmdq,vmdq_dcb'

meson --default-library=static $MESON_PARAMS --cross-file config/arm/arm64_armv8_linuxapp_gcc arm64-static-build
ninja -C arm64-static-build

> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24 11:17   ` Jerin Jacob
@ 2018-05-24 13:20     ` Bruce Richardson
  2018-05-25  7:00       ` Gavin Hu
  2018-05-24 13:54     ` Thomas Monjalon
  1 sibling, 1 reply; 59+ messages in thread
From: Bruce Richardson @ 2018-05-24 13:20 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Gavin Hu, dev

On Thu, May 24, 2018 at 04:47:56PM +0530, Jerin Jacob wrote:
> -----Original Message-----
> > Date: Wed, 23 May 2018 23:38:47 -0400
> > From: Gavin Hu <gavin.hu@arm.com>
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling
> >  from x86
> > X-Mailer: git-send-email 2.1.4
> > 
> > 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>
> 
> In addition to comments from Marko,
> 
> > ---
> >  doc/cross_compiling_sdk.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++
> 
> I think, instead of keeping it as a orphan document, IMO, it should linked with
> https://dpdk.org/doc/guides/
> I think, it can go a new section or "HowTo Guides" section, So that in future armv7 and/or PowerPC cross
> compilation details can be added.
> 
> 
> >  1 file changed, 58 insertions(+)
> >  create mode 100644 doc/cross_compiling_sdk.txt
> > 
> > diff --git a/doc/cross_compiling_sdk.txt b/doc/cross_compiling_sdk.txt
> > new file mode 100644
> > index 0000000..aa08871
> > --- /dev/null
> > +++ b/doc/cross_compiling_sdk.txt
> > @@ -0,0 +1,58 @@
> > +How to cross compile DPDK for ARM64
> > +-----------------------------------
> > +
> > +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, which currently requires
> > +the NUMA libraries to be integrated. Following are the steps to follow.
> > +
> > +1. 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 so far.
> > +$ 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
> > +
> > +2. Unzip and add into the PATH
> > +------------------------------
> > +$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> > +$ export PATH=$PATH:<install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
> > +Note: For the host requirements and ohter info, refer to the release note section:
> > +https://releases.linaro.org/components/toolchain/binaries/latest/
> > +
> > +3. Getting the prerequisite library
> > +-----------------------------------
> > +-- NUMA
> > +--Prequisite: make sure the installed libtool version >= 2.2(run libtool --version to check),
> > +otherwise the compilation will fail with errors.
> > +$ 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
> > +$ make
> > +
> > +4. Install the numa header and lib
> > +----------------------------------
> > +Copy the header files to the cross compiler's include directory:
> > +$ cp numa*.h <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
> > +Copy the numa lib to the cross compiler;s lib directory:
> > +$ cp .libs/libnuma.a <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
> 
> Installing numactrl header files and library files to toolchain area
> does not looks very correct. IMO, You can use --prefix option in
> numactrl to install to separate directory and add the include details through
> EXTRA_CFLAGS and EXTRA_LDFLAGS. This will help in meson for pkg-config
> related case as well.
> 
> > +
> > +5. Configuring the DPDK Build
> > +-----------------------------
> > +To configure a build, follow the build-sdk-quick.txt file to select the target
> > +configuration.
> > +$ make config T=arm64-armv8a-linuxapp-gcc
> 
> IMO, You can mentioned about other armv8 target such as
> defconfig_arm64-dpaa2-linuxapp-gcc/defconfig_arm64-thunderx-linuxapp-gcc
> for optimized build specific to target.
> 
> > +
> > +6. Cross Compiling DPDK
> > +-----------------------
> > +To cross-compile DPDK for ARM64 target machine, without compiling the kernel modules, use the following
> > +command:
> > +$ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
> 
> I think, you could mention to set CONFIG_RTE_LIBRTE_VHOST_NUMA=n and
> CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n for NON numa systems to avoid
> building numactl for single node systems.
> 
> > +
> > +To cross-compile DPDK for ARM64, including the kernel modules, the kernel source tree is required.
> > +Set RTE_KERNEL_SRC_ROOTDIR to the kernel source tree folder and use the following command:
> > +$ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=KERNEL_SRC_ROOTDIR CROSS_COMPILE=aarch64-linux-gnu-
> 
> You could add meson cross build details too.
> 
> export MESON_PARAMS='-Dwerror=true
> -Dexamples=bond,bbdev_app,cmdline,distributor,eventdev_pipeline,exception_path,flow_classify,flow_filtering,helloworld,ip_fragmentation,ip_pipeline,ip_reassembly,ipsec-secgw,ipv4_multicast,kni,l2fwd,l2fwd-crypto,l2fwd-jobstats,l2fwd-keepalive,l3fwd,l3fwd-acl,l3fwd-power,l3fwd-vf,link_status_interrupt,load_balancer,packet_ordering,ptpclient,qos_meter,qos_sched,rxtx_callbacks,service_cores,skeleton,tep_termination,timer,vhost,vhost_scsi,vmdq,vmdq_dcb'
> 

This long list of examples can now be shortened to "all", since meson now
has each app detecting if it can be compiled or not.

> meson --default-library=static $MESON_PARAMS --cross-file config/arm/arm64_armv8_linuxapp_gcc arm64-static-build
> ninja -C arm64-static-build
> 

/Bruce

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH 1/2] mk: fix cross build errors
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 1/2] mk: fix cross build errors Gavin Hu
@ 2018-05-24 13:46   ` Thomas Monjalon
  2018-05-25  7:53     ` Gavin Hu
  0 siblings, 1 reply; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-24 13:46 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev

24/05/2018 05:38, Gavin Hu:
> +ifeq ($(shell test $(USE_HOST) -e 1 && test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)

I think there is an error above.
-e should be -eq, isn't it?

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24 11:17   ` Jerin Jacob
  2018-05-24 13:20     ` Bruce Richardson
@ 2018-05-24 13:54     ` Thomas Monjalon
  2018-05-24 17:16       ` Jerin Jacob
  1 sibling, 1 reply; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-24 13:54 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, Jerin Jacob

24/05/2018 13:17, Jerin Jacob:
> -----Original Message-----
> > Date: Wed, 23 May 2018 23:38:47 -0400
> > From: Gavin Hu <gavin.hu@arm.com>
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling
> >  from x86
> > X-Mailer: git-send-email 2.1.4
> > 
> > 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>
> 
> In addition to comments from Marko,
> 
> > ---
> >  doc/cross_compiling_sdk.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++
> 
> I think, instead of keeping it as a orphan document, IMO, it should linked with
> https://dpdk.org/doc/guides/
> I think, it can go a new section or "HowTo Guides" section, So that in future armv7 and/or PowerPC cross
> compilation details can be added.

I think the right location is http://dpdk.org/doc/guides/linux_gsg/build_dpdk.html

This patch is far from being ready, so please send the patch 1,
which is a fix, separately.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24 13:54     ` Thomas Monjalon
@ 2018-05-24 17:16       ` Jerin Jacob
  2018-05-24 20:31         ` Thomas Monjalon
  0 siblings, 1 reply; 59+ messages in thread
From: Jerin Jacob @ 2018-05-24 17:16 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Gavin Hu, dev

-----Original Message-----
> Date: Thu, 24 May 2018 15:54:00 +0200
> From: Thomas Monjalon <thomas@monjalon.net>
> To: Gavin Hu <gavin.hu@arm.com>
> Cc: dev@dpdk.org, Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Subject: Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross
>  compiling from x86
> 
> 24/05/2018 13:17, Jerin Jacob:
> > -----Original Message-----
> > > Date: Wed, 23 May 2018 23:38:47 -0400
> > > From: Gavin Hu <gavin.hu@arm.com>
> > > To: dev@dpdk.org
> > > Subject: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling
> > >  from x86
> > > X-Mailer: git-send-email 2.1.4
> > > 
> > > 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>
> > 
> > In addition to comments from Marko,
> > 
> > > ---
> > >  doc/cross_compiling_sdk.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++
> > 
> > I think, instead of keeping it as a orphan document, IMO, it should linked with
> > https://dpdk.org/doc/guides/
> > I think, it can go a new section or "HowTo Guides" section, So that in future armv7 and/or PowerPC cross
> > compilation details can be added.
> 
> I think the right location is http://dpdk.org/doc/guides/linux_gsg/build_dpdk.html

I think, that link is specific to Linux.What about freebsd ? That reason why I thought to have neutral location.
No strong opinion on the location though.

> 
> This patch is far from being ready, so please send the patch 1,
> which is a fix, separately.
> 
> 

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24 17:16       ` Jerin Jacob
@ 2018-05-24 20:31         ` Thomas Monjalon
  0 siblings, 0 replies; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-24 20:31 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Gavin Hu, dev

24/05/2018 19:16, Jerin Jacob:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 24/05/2018 13:17, Jerin Jacob:
> > > From: Gavin Hu <gavin.hu@arm.com>
> > > >  doc/cross_compiling_sdk.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++
> > > 
> > > I think, instead of keeping it as a orphan document, IMO, it should linked with
> > > https://dpdk.org/doc/guides/
> > > I think, it can go a new section or "HowTo Guides" section, So that in future armv7 and/or PowerPC cross
> > > compilation details can be added.
> > 
> > I think the right location is http://dpdk.org/doc/guides/linux_gsg/build_dpdk.html
> 
> I think, that link is specific to Linux.

Right

> What about freebsd ?

I think FreeBSD + ARM is a niche.
We can start with Linux and re-organize these guides to be common later.

> That reason why I thought to have neutral location.
> No strong opinion on the location though.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-24 13:20     ` Bruce Richardson
@ 2018-05-25  7:00       ` Gavin Hu
  0 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-25  7:00 UTC (permalink / raw)
  To: Bruce Richardson, Jerin Jacob; +Cc: dev

Hi Bruce and Jerin,

Thanks for your comments, some inline feedback for your comments.

Any further comments are welcome.

Best Regards,
Gavin

-----Original Message-----
From: Bruce Richardson <bruce.richardson@intel.com>
Sent: Thursday, May 24, 2018 9:21 PM
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: Gavin Hu <Gavin.Hu@arm.com>; dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86

On Thu, May 24, 2018 at 04:47:56PM +0530, Jerin Jacob wrote:
> -----Original Message-----
> > Date: Wed, 23 May 2018 23:38:47 -0400
> > From: Gavin Hu <gavin.hu@arm.com>
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross
> > compiling  from x86
> > X-Mailer: git-send-email 2.1.4
> >
> > 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>
>
> In addition to comments from Marko,
>
> > ---
> >  doc/cross_compiling_sdk.txt | 58
> > +++++++++++++++++++++++++++++++++++++++++++++
>
> I think, instead of keeping it as a orphan document, IMO, it should
> linked with https://dpdk.org/doc/guides/ I think, it can go a new
> section or "HowTo Guides" section, So that in future armv7 and/or
> PowerPC cross compilation details can be added.
>

I can move it to "HowTo Guides", but all the guides are not for compiling.
On the contrary, there are two other docs for compiling in this place
To maintain relevancy and consistency, should we keep it here?
http://dpdk.org/browse/dpdk/tree/doc/build-sdk-meson.txt
http://dpdk.org/browse/dpdk/tree/doc/build-sdk-quick.txt


> >  1 file changed, 58 insertions(+)
> >  create mode 100644 doc/cross_compiling_sdk.txt
> >
> > diff --git a/doc/cross_compiling_sdk.txt
> > b/doc/cross_compiling_sdk.txt new file mode 100644 index
> > 0000000..aa08871
> > --- /dev/null
> > +++ b/doc/cross_compiling_sdk.txt
> > @@ -0,0 +1,58 @@
> > +How to cross compile DPDK for ARM64
> > +-----------------------------------
> > +
> > +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, which currently
> > +requires the NUMA libraries to be integrated. Following are the steps to follow.
> > +
> > +1. Obtain the cross tool chain
> > +------------------------------
> > +The latest cross compile tool chain can be downloaded from:
> > +https://releases.linaro.org/components/toolchain/binaries/latest/aa
> > +rch64-linux-gnu/ Following is the step to get the version 7.2.1,
> > +latest so far.
> > +$ 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
> > +
> > +2. Unzip and add into the PATH
> > +------------------------------
> > +$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
> > +$ export PATH=$PATH:<install
> > +dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin
> > +Note: For the host requirements and ohter info, refer to the release note section:
> > +https://releases.linaro.org/components/toolchain/binaries/latest/
> > +
> > +3. Getting the prerequisite library
> > +-----------------------------------
> > +-- NUMA
> > +--Prequisite: make sure the installed libtool version >= 2.2(run
> > +libtool --version to check), otherwise the compilation will fail with errors.
> > +$ 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 $ make
> > +
> > +4. Install the numa header and lib
> > +----------------------------------
> > +Copy the header files to the cross compiler's include directory:
> > +$ cp numa*.h <install
> > +dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch
> > +64-linux-gnu/libc/usr/include/ Copy the numa lib to the cross
> > +compiler;s lib directory:
> > +$ cp .libs/libnuma.a <install
> > +dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarc
> > +h64-linux-gnu/7.2.1/
>
> Installing numactrl header files and library files to toolchain area
> does not looks very correct. IMO, You can use --prefix option in
> numactrl to install to separate directory and add the include details
> through EXTRA_CFLAGS and EXTRA_LDFLAGS. This will help in meson for
> pkg-config related case as well.


I simply tried, it did not work out yet, will try again.

> > +
> > +5. Configuring the DPDK Build
> > +-----------------------------
> > +To configure a build, follow the build-sdk-quick.txt file to select
> > +the target configuration.
> > +$ make config T=arm64-armv8a-linuxapp-gcc
>
> IMO, You can mentioned about other armv8 target such as
> defconfig_arm64-dpaa2-linuxapp-gcc/defconfig_arm64-thunderx-linuxapp-g
> cc for optimized build specific to target.

Ok, I will fix it in next version.

> > +6. Cross Compiling DPDK
> > +-----------------------
> > +To cross-compile DPDK for ARM64 target machine, without compiling
> > +the kernel modules, use the following
> > +command:
> > +$ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n
> > +CONFIG_RTE_EAL_IGB_UIO=n
>
> I think, you could mention to set CONFIG_RTE_LIBRTE_VHOST_NUMA=n and
> CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n for NON numa systems to avoid
> building numactl for single node systems.

Ok, I will fix it in next version.

> > +
> > +To cross-compile DPDK for ARM64, including the kernel modules, the kernel source tree is required.
> > +Set RTE_KERNEL_SRC_ROOTDIR to the kernel source tree folder and use the following command:
> > +$ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=KERNEL_SRC_ROOTDIR
> > +CROSS_COMPILE=aarch64-linux-gnu-
>
> You could add meson cross build details too.
>
> export MESON_PARAMS='-Dwerror=true
> -Dexamples=bond,bbdev_app,cmdline,distributor,eventdev_pipeline,exception_path,flow_classify,flow_filtering,helloworld,ip_fragmentation,ip_pipeline,ip_reassembly,ipsec-secgw,ipv4_multicast,kni,l2fwd,l2fwd-crypto,l2fwd-jobstats,l2fwd-keepalive,l3fwd,l3fwd-acl,l3fwd-power,l3fwd-vf,link_status_interrupt,load_balancer,packet_ordering,ptpclient,qos_meter,qos_sched,rxtx_callbacks,service_cores,skeleton,tep_termination,timer,vhost,vhost_scsi,vmdq,vmdq_dcb'
>

This long list of examples can now be shortened to "all", since meson now has each app detecting if it can be compiled or not.

> meson --default-library=static $MESON_PARAMS --cross-file
> config/arm/arm64_armv8_linuxapp_gcc arm64-static-build ninja -C
> arm64-static-build
>

There is already a section for meson cross compiling in http://dpdk.org/browse/dpdk/tree/doc/build-sdk-meson.txt
This doc will cover GNU Makefile cross gcc.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH 1/2] mk: fix cross build errors
  2018-05-24 13:46   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
@ 2018-05-25  7:53     ` Gavin Hu
  0 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-25  7:53 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



-----Original Message-----
From: Thomas Monjalon <thomas@monjalon.net>
Sent: Thursday, May 24, 2018 9:47 PM
To: Gavin Hu <Gavin.Hu@arm.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-stable] [PATCH 1/2] mk: fix cross build errors

24/05/2018 05:38, Gavin Hu:
> +ifeq ($(shell test $(USE_HOST) -e 1 && test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)

I think there is an error above.
-e should be -eq, isn't it?
[Gavin Hu] I will fix it in next version of patch, thanks!




IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-24  3:38 [dpdk-dev] [PATCH 0/2] *** gcc cross compile dpdk *** Gavin Hu
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 1/2] mk: fix cross build errors Gavin Hu
  2018-05-24  3:38 ` [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-28  6:53 ` Gavin Hu
  2018-05-28  6:53   ` [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
                     ` (2 more replies)
  2 siblings, 3 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-28  6:53 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu, stable

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 is older than 7.0, 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>
Reviewed-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 bf07b6f..ff7a5fa 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 255c896..1e4434f 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 7e4531b..d8b99fa 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.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-28  6:53 ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Gavin Hu
@ 2018-05-28  6:53   ` Gavin Hu
  2018-05-28 13:25     ` Bruce Richardson
  2018-05-28 16:01     ` Kovacevic, Marko
  2018-05-28 13:24   ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Bruce Richardson
  2018-05-29  6:51   ` [dpdk-dev] [PATCH v3 " Gavin Hu
  2 siblings, 2 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-28  6:53 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu

This is guild for cross compiling for ARM64 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>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/guides/howto/index.rst                         |  1 +
 .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 70 ++++++++++++++++++++++
 doc/guides/linux_gsg/index.rst                     |  1 +
 3 files changed, 72 insertions(+)
 create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
index e13a090..35ac151 100644
--- a/doc/guides/howto/index.rst
+++ b/doc/guides/howto/index.rst
@@ -8,6 +8,7 @@ HowTo Guides
     :maxdepth: 2
     :numbered:
 
+	cross_compile_sdk_for_arm64
     lm_bond_virtio_sriov
     lm_virtio_vhost_user
     flow_bifurcation
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 0000000..2abf2e8
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,70 @@
+How to cross compile DPDK for ARM64
+-----------------------------------
+
+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, which currently requires
+the NUMA libraries to be integrated. Following are the steps to follow.
+
+1. 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 so far.
+$ 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
+
+2. Unzip and add into the PATH
+------------------------------
+$ tar -xvf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
+$ export PATH=$PATH:<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/
+
+3. Getting the prerequisite library
+-----------------------------------
+-- NUMA (Note: Required by most modern machines, not needed for non-NUMA ones)
+--Prerequisite: for compiling NUMA, make sure the installed libtool version >= 2.2
+(run libtool --version to check), otherwise the compilation will fail with errors.
+$ 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
+You will get numa*.h files under <numa install dir>/include and libnuma.a under <numa install dor>/lib.
+
+4. Augument the cross gcc toolchain with the NUMA header and lib
+----------------------------------------------------------------
+Note: This way is optional, the alternative way is to use extra CFLAGS and LDFLAGS, depicted in Step 6)*
+Copy the NUMA header files to the cross compiler's include directory:
+$ cp <numa install dir>/include/numa*.h <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../aarch64-linux-gnu/libc/usr/include/
+Copy the NUMA lib to the cross compiler's lib directory:
+$ cp <numa install dir>/lib/libnuma.a <install dir>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.2.1/
+
+5. Configuring the DPDK Build
+-----------------------------
+To configure a build, follow the build-sdk-quick.txt file to select one of the target configurations,like
+arm64-dpaa2-linuxapp-gcc and arm64-thunderx-linuxapp-gcc for optimized build specific to target.
+
+$ make config T=arm64-armv8a-linuxapp-gcc
+
+6. Cross Compiling DPDK
+-----------------------
+To cross-compile DPDK for ARM64 target machine, without compiling the kernel modules, use the following
+command:
+$ make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n
+
+To cross-compile DPDK for ARM64, including the kernel modules, the kernel source tree is required.
+Set RTE_KERNEL_SRC_ROOTDIR to the kernel source tree folder and use the following command:
+$ make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<KERNEL_SRC_ROOTDIR> CROSS_COMPILE=aarch64-linux-gnu-
+
+Note:
+1. If the target machine is non-NUMA, add the following to the command:
+CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n
+2. If Step 4 is skipped and the toolchain was not augumented with the NUMA headers and library.
+Add EXTRA CFLAGS and LDFLAGS for the NUMA header and library. RTE_DEVEL_BUILD has to be disabled, otherwise
+the numa.h file will get a lot of Werror=cast-qual, Werror=strict-prototypes and Werror=old-style-definition
+compiling errors.
+EXTRA_CFLAGS="-I/opt/cccc/include" EXTRA_LDFLAGS="-L<numa install dir>/lib -lnuma" RTE_DEVEL_BUILD=n
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe..c5b1695 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.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-28  6:53 ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Gavin Hu
  2018-05-28  6:53   ` [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-28 13:24   ` Bruce Richardson
  2018-05-29  1:22     ` Gavin Hu
  2018-05-29 14:45     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  2018-05-29  6:51   ` [dpdk-dev] [PATCH v3 " Gavin Hu
  2 siblings, 2 replies; 59+ messages in thread
From: Bruce Richardson @ 2018-05-28 13:24 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, stable

On Mon, May 28, 2018 at 02:53:47AM -0400, Gavin Hu wrote:
> 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 is older than 7.0, 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>
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Would a simpler solution for this not be to put "-Wno-implicit-fallthrough"
for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
flag when compiling, unless there are other errors. This means we can just
use the flag without bothering with version checks.

/Bruce

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-28  6:53   ` [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-28 13:25     ` Bruce Richardson
  2018-05-29  1:24       ` Gavin Hu
  2018-05-28 16:01     ` Kovacevic, Marko
  1 sibling, 1 reply; 59+ messages in thread
From: Bruce Richardson @ 2018-05-28 13:25 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev

On Mon, May 28, 2018 at 02:53:48AM -0400, Gavin Hu wrote:
> This is guild for cross compiling for ARM64 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>
> Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
> Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Can you also include details of cross-compiling using meson from the meson
build text file too?

/Bruce

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-28  6:53   ` [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-28 13:25     ` Bruce Richardson
@ 2018-05-28 16:01     ` Kovacevic, Marko
  1 sibling, 0 replies; 59+ messages in thread
From: Kovacevic, Marko @ 2018-05-28 16:01 UTC (permalink / raw)
  To: Gavin Hu, dev

> This is guild for cross compiling for ARM64 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>
> Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
> Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Hi Gavin,

After reviewing your file in the .rst format it doesn't look good, the whole formatting is wrong and
unreadable. As you have the wrong headers and sections. You have code block and command line arguments 
added in everywhere making it not look good. Also you have added an index to a file in the howto that doesn't exist.

dpdk/doc/guides/howto/index.rst:7: WARNING: toctree contains reference to nonexisting document u'howto/    cross_compile_sdk_for_arm64'
dpdk/doc/guides/linux_gsg/index.rst:9: WARNING: toctree contains reference to nonexisting document u'linux_gsg/    cross_build_dpdk_for_arm64'
dpdk/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst: WARNING: document isn't included in any toctree

Id advise you go to this link and familiarize yourself with the proper way of writing in the rst format.
And also try and view the html version of your file before you send it out to make sure it looks ok.

If you adding command line arguments into text use this ``make -j CROSS=aarch64-linux-gnu- CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_EAL_IGB_UIO=n``

http://dpdk.org/doc/guides/contributing/documentation.html

Marko K

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-28 13:24   ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Bruce Richardson
@ 2018-05-29  1:22     ` Gavin Hu
  2018-05-29 14:45     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  1 sibling, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  1:22 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

Hi Bruce,

Thanks for your helpful comment, see my inline comments.

Best Regards,
Gavin

-----Original Message-----
From: Bruce Richardson <bruce.richardson@intel.com>
Sent: Monday, May 28, 2018 9:24 PM
To: Gavin Hu <Gavin.Hu@arm.com>
Cc: dev@dpdk.org; stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors

On Mon, May 28, 2018 at 02:53:47AM -0400, Gavin Hu wrote:
> 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 is older than 7.0,
> 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>
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Would a simpler solution for this not be to put "-Wno-implicit-fallthrough"
for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
flag when compiling, unless there are other errors. This means we can just use the flag without bothering with version checks.

 [Gavin Hu] I tried your proposal, added "-Wno-implicit-fallthrough" before $( WERROR_FLAGS) in the pmdinfo Makefile.
It took precedence and made following " Wimplicit-fallthrough=2" useless, the compilation succeeded.

Is this what you mean?
Note the two options must be in this order, otherwise the compiling error still hit.

Another option is totally disable WERROR_FLAGS for pmdinfo, but this is not a best way as it includes a lot of other options.

toolchain/gcc/rte.vars.mk:46:WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
toolchain/gcc/rte.vars.mk:47:WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
toolchain/gcc/rte.vars.mk:48:WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual
toolchain/gcc/rte.vars.mk:49:WERROR_FLAGS += -Wformat-nonliteral -Wformat-security
toolchain/gcc/rte.vars.mk:50:WERROR_FLAGS += -Wundef -Wwrite-strings -Wdeprecated
toolchain/gcc/rte.vars.mk:53:WERROR_FLAGS += -Werror
toolchain/gcc/rte.vars.mk:59:WERROR_FLAGS += -Wno-error=cast-align
toolchain/gcc/rte.vars.mk:67:WERROR_FLAGS += -Wno-missing-field-initializers
toolchain/gcc/rte.vars.mk:71:WERROR_FLAGS += -Wno-uninitialized
toolchain/gcc/rte.vars.mk:85:WERROR_FLAGS += -Wimplicit-fallthrough=2
toolchain/gcc/rte.vars.mk:87:WERROR_FLAGS += -Wno-format-truncation

/Bruce
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-28 13:25     ` Bruce Richardson
@ 2018-05-29  1:24       ` Gavin Hu
  0 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  1:24 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev



-----Original Message-----
From: Bruce Richardson <bruce.richardson@intel.com>
Sent: Monday, May 28, 2018 9:25 PM
To: Gavin Hu <Gavin.Hu@arm.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86

On Mon, May 28, 2018 at 02:53:48AM -0400, Gavin Hu wrote:
> This is guild for cross compiling for ARM64 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>
> Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
> Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Can you also include details of cross-compiling using meson from the meson build text file too?
[Gavin Hu] My pleasure, I will work on it, it will be in a separate patch.

/Bruce
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v3 1/2] mk: fix cross build errors
  2018-05-28  6:53 ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Gavin Hu
  2018-05-28  6:53   ` [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-28 13:24   ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Bruce Richardson
@ 2018-05-29  6:51   ` Gavin Hu
  2018-05-29  6:51     ` [dpdk-dev] [PATCH v3 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-29  7:21     ` [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc *** Gavin Hu
  2 siblings, 2 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  6:51 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu, stable

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 is older than 7.0, 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>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/pmdinfogen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f..8ee6427 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 += -Wno-implicit-fallthrough $(WERROR_FLAGS) -g
 HOST_CFLAGS += -I$(RTE_OUTPUT)/include
 
 include $(RTE_SDK)/mk/rte.hostapp.mk
-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29  6:51   ` [dpdk-dev] [PATCH v3 " Gavin Hu
@ 2018-05-29  6:51     ` Gavin Hu
  2018-05-29  7:21     ` [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc *** Gavin Hu
  1 sibling, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  6:51 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu

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>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 125 +++++++++++++++++++++
 doc/guides/linux_gsg/index.rst                     |   1 +
 2 files changed, 126 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 0000000..b603f6e
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,125 @@
+..  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 in this writting.
+
+.. 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 archtectures.
+
+.. 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>.
+
+.. _augument_the_cross_toolcain_with_numa_support:
+
+Augument 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 step :ref:`augument_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+   augumented with NUMA support.
+
+   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h file gets
+   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
+      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-I<numa_install_dir>/include" EXTRA_LDFLAGS=
+      "-L<numa_install_dir>/lib -lnuma"
+
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe..077f930 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.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc ***
  2018-05-29  6:51   ` [dpdk-dev] [PATCH v3 " Gavin Hu
  2018-05-29  6:51     ` [dpdk-dev] [PATCH v3 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-29  7:21     ` Gavin Hu
  2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 1/2] mk: fix cross build errors Gavin Hu
                         ` (2 more replies)
  1 sibling, 3 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  7:21 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu

*** 1. Simply use -Wnoimplicit-fallthrough for pmdinfogen, other than gcc version check. ***
*** 2. Make the doc in the correct format ***
*** 3. Correct the rst index file ***

Gavin Hu (2):
  mk: fix cross build errors
  doc: add a guide doc for cross compiling from x86

 buildtools/pmdinfogen/Makefile                     |   2 +-
 .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 125 +++++++++++++++++++++
 doc/guides/linux_gsg/index.rst                     |   1 +
 3 files changed, 127 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst

-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v4 1/2] mk: fix cross build errors
  2018-05-29  7:21     ` [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc *** Gavin Hu
@ 2018-05-29  7:21       ` Gavin Hu
  2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-29 10:43       ` [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc *** Gavin Hu
  2 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  7:21 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu, stable

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 is older than 7.0, it should not
be enabled.

The fix is to simply enable -Wnoimplicit-fallthrough for pmdinfogen.

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>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/pmdinfogen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f..8ee6427 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 += -Wno-implicit-fallthrough $(WERROR_FLAGS) -g
 HOST_CFLAGS += -I$(RTE_OUTPUT)/include
 
 include $(RTE_SDK)/mk/rte.hostapp.mk
-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v4 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29  7:21     ` [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc *** Gavin Hu
  2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 1/2] mk: fix cross build errors Gavin Hu
@ 2018-05-29  7:21       ` Gavin Hu
  2018-05-29  8:39         ` Kovacevic, Marko
  2018-05-29 10:43       ` [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc *** Gavin Hu
  2 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-05-29  7:21 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu

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>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 125 +++++++++++++++++++++
 doc/guides/linux_gsg/index.rst                     |   1 +
 2 files changed, 126 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 0000000..f97b931
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,125 @@
+..  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 archtectures.
+
+.. 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>.
+
+.. _augument_the_cross_toolcain_with_numa_support:
+
+Augument 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 step :ref:`augument_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+   augumented with NUMA support.
+
+   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h file gets
+   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
+      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-I<numa_install_dir>/include" EXTRA_LDFLAGS=
+      "-L<numa_install_dir>/lib -lnuma"
+
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe..077f930 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.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-29  8:39         ` Kovacevic, Marko
  0 siblings, 0 replies; 59+ messages in thread
From: Kovacevic, Marko @ 2018-05-29  8:39 UTC (permalink / raw)
  To: Gavin Hu, dev

> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
>
>  .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 125
> +++++++++++++++++++++
>  doc/guides/linux_gsg/index.rst                     |   1 +
>  2 files changed, 126 insertions(+)
>
> +Cross compile DPDK for ARM64
> +============================

<...>

> +Getting the prerequisite library
> +--------------------------------
> +
> +NUMA is required by most modern machines, not needed for non-NUMA
> archtectures.
> +

Spelling    archtectures/ architectures

<...>

> +
> +.. _augument_the_cross_toolcain_with_numa_support:
> +
> +Augument the cross toolchain with NUMA support
> +----------------------------------------------
> +

Both  augument / Augment 

<...>

> +   1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the
> NUMA headers and link the library respectively,
> +   if the step :ref:`augument_the_cross_toolcain_with_numa_support` was
> skipped therefore the toolchain was not
> +   augumented with NUMA support.

Spelling for two cases again     Augument/ Augment

<...>

Good work way better version this time looks clean.

Marko K.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc ***
  2018-05-29  7:21     ` [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc *** Gavin Hu
  2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 1/2] mk: fix cross build errors Gavin Hu
  2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-29 10:43       ` Gavin Hu
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 1/2] mk: fix cross build errors Gavin Hu
                           ` (2 more replies)
  2 siblings, 3 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29 10:43 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu

*** Correct two spelling errors in the doc ***

Gavin Hu (2):
  mk: fix cross build errors
  doc: add a guide doc for cross compiling from x86

 buildtools/pmdinfogen/Makefile                     |   2 +-
 .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 125 +++++++++++++++++++++
 doc/guides/linux_gsg/index.rst                     |   1 +
 3 files changed, 127 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst

-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v5 1/2] mk: fix cross build errors
  2018-05-29 10:43       ` [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc *** Gavin Hu
@ 2018-05-29 10:43         ` Gavin Hu
  2018-05-29 15:09           ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
  2 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-05-29 10:43 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu, stable

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 is older than 7.0, it should not
be enabled.

The fix is to simply enable -Wnoimplicit-fallthrough for pmdinfogen.

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>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/pmdinfogen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bf07b6f..8ee6427 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 += -Wno-implicit-fallthrough $(WERROR_FLAGS) -g
 HOST_CFLAGS += -I$(RTE_OUTPUT)/include
 
 include $(RTE_SDK)/mk/rte.hostapp.mk
-- 
2.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29 10:43       ` [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc *** Gavin Hu
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 1/2] mk: fix cross build errors Gavin Hu
@ 2018-05-29 10:43         ` Gavin Hu
  2018-05-29 13:33           ` Kovacevic, Marko
                             ` (2 more replies)
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
  2 siblings, 3 replies; 59+ messages in thread
From: Gavin Hu @ 2018-05-29 10:43 UTC (permalink / raw)
  To: dev; +Cc: gavin.hu

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>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst       | 125 +++++++++++++++++++++
 doc/guides/linux_gsg/index.rst                     |   1 +
 2 files changed, 126 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 0000000..4864f8f
--- /dev/null
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -0,0 +1,125 @@
+..  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 step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
+   argmented with NUMA support.
+
+   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h file gets
+   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
+      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-I<numa_install_dir>/include" EXTRA_LDFLAGS=
+      "-L<numa_install_dir>/lib -lnuma"
+
diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
index 2a7bdfe..077f930 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.1.4

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-05-29 13:33           ` Kovacevic, Marko
  2018-05-30 19:16           ` Thomas Monjalon
  2018-05-30 19:35           ` Jerin Jacob
  2 siblings, 0 replies; 59+ messages in thread
From: Kovacevic, Marko @ 2018-05-29 13:33 UTC (permalink / raw)
  To: Gavin Hu, dev

Can you supersede your v4. :)

After looking at the v5 looks good to me.

Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-28 13:24   ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Bruce Richardson
  2018-05-29  1:22     ` Gavin Hu
@ 2018-05-29 14:45     ` Thomas Monjalon
  2018-05-29 15:00       ` Bruce Richardson
  1 sibling, 1 reply; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-29 14:45 UTC (permalink / raw)
  To: Bruce Richardson, Gavin Hu; +Cc: dev

28/05/2018 15:24, Bruce Richardson:
> Would a simpler solution for this not be to put "-Wno-implicit-fallthrough"
> for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
> flag when compiling, unless there are other errors. This means we can just
> use the flag without bothering with version checks.

No, it does not work.
I have this error with clang 5.0.1:
	error: unknown warning option '-Wno-format-truncation'

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-29 14:45     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
@ 2018-05-29 15:00       ` Bruce Richardson
  2018-05-29 16:20         ` Gavin Hu
  0 siblings, 1 reply; 59+ messages in thread
From: Bruce Richardson @ 2018-05-29 15:00 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Gavin Hu, dev

On Tue, May 29, 2018 at 04:45:55PM +0200, Thomas Monjalon wrote:
> 28/05/2018 15:24, Bruce Richardson:
> > Would a simpler solution for this not be to put "-Wno-implicit-fallthrough"
> > for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
> > flag when compiling, unless there are other errors. This means we can just
> > use the flag without bothering with version checks.
> 
> No, it does not work.
> I have this error with clang 5.0.1:
> 	error: unknown warning option '-Wno-format-truncation'
> 
Yes, you still need to check for GCC to use the flag, just not for a
specific version of GCC.

/Bruce

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v5 1/2] mk: fix cross build errors
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 1/2] mk: fix cross build errors Gavin Hu
@ 2018-05-29 15:09           ` Thomas Monjalon
  0 siblings, 0 replies; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-29 15:09 UTC (permalink / raw)
  To: Gavin Hu; +Cc: stable, dev

29/05/2018 12:43, Gavin Hu:
> --- a/buildtools/pmdinfogen/Makefile
> +++ b/buildtools/pmdinfogen/Makefile
> -HOST_CFLAGS += $(WERROR_FLAGS) -g
> +HOST_CFLAGS += -Wno-implicit-fallthrough $(WERROR_FLAGS) -g

There is a compilation error with clang. Please see this comment:
	http://dpdk.org/ml/archives/dev/2018-May/103136.html

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-29 15:00       ` Bruce Richardson
@ 2018-05-29 16:20         ` Gavin Hu
  2018-05-29 19:53           ` Thomas Monjalon
  0 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-05-29 16:20 UTC (permalink / raw)
  To: Bruce Richardson, Thomas Monjalon; +Cc: dev



> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, May 29, 2018 11:00 PM
> To: Thomas Monjalon <thomas@monjalon.net>
> Cc: Gavin Hu <Gavin.Hu@arm.com>; dev@dpdk.org
> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/2] mk: fix cross build
> errors
>
> On Tue, May 29, 2018 at 04:45:55PM +0200, Thomas Monjalon wrote:
> > 28/05/2018 15:24, Bruce Richardson:
> > > Would a simpler solution for this not be to put "-Wno-implicit-
> fallthrough"
> > > for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
> > > flag when compiling, unless there are other errors. This means we
> > > can just use the flag without bothering with version checks.
> >
> > No, it does not work.
> > I have this error with clang 5.0.1:
> > error: unknown warning option '-Wno-format-truncation'
> >
> Yes, you still need to check for GCC to use the flag, just not for a specific
> version of GCC.
>
> /Bruce
Hi Thomas, did you meet this clang error when you applied my patch(which version?) or your own one?
@Bruce and Thomas, Could you review my v5 patch?  Thanks!

/Gavin

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 1/2] mk: fix cross build errors
  2018-05-29 16:20         ` Gavin Hu
@ 2018-05-29 19:53           ` Thomas Monjalon
  0 siblings, 0 replies; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-29 19:53 UTC (permalink / raw)
  To: Gavin Hu; +Cc: Bruce Richardson, dev

29/05/2018 18:20, Gavin Hu:
> 
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > Sent: Tuesday, May 29, 2018 11:00 PM
> > To: Thomas Monjalon <thomas@monjalon.net>
> > Cc: Gavin Hu <Gavin.Hu@arm.com>; dev@dpdk.org
> > Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/2] mk: fix cross build
> > errors
> >
> > On Tue, May 29, 2018 at 04:45:55PM +0200, Thomas Monjalon wrote:
> > > 28/05/2018 15:24, Bruce Richardson:
> > > > Would a simpler solution for this not be to put "-Wno-implicit-
> > fallthrough"
> > > > for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
> > > > flag when compiling, unless there are other errors. This means we
> > > > can just use the flag without bothering with version checks.
> > >
> > > No, it does not work.
> > > I have this error with clang 5.0.1:
> > > error: unknown warning option '-Wno-format-truncation'
> > >
> > Yes, you still need to check for GCC to use the flag, just not for a specific
> > version of GCC.
> >
> > /Bruce
> Hi Thomas, did you meet this clang error when you applied my patch(which version?) or your own one?
> @Bruce and Thomas, Could you review my v5 patch?  Thanks!

I've already replied to your v5.
The error is seen with your v5.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-29 13:33           ` Kovacevic, Marko
@ 2018-05-30 19:16           ` Thomas Monjalon
  2018-05-30 19:35           ` Jerin Jacob
  2 siblings, 0 replies; 59+ messages in thread
From: Thomas Monjalon @ 2018-05-30 19:16 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev

29/05/2018 12:43, Gavin Hu:
> 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>
> Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
> Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>

I have not reviewed the content of this patch.
And not sure Jerin and Bruce approve this v5.
Please make sure we fully agree with the patch before adding our
"Reviewed-by" tag.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
  2018-05-29 13:33           ` Kovacevic, Marko
  2018-05-30 19:16           ` Thomas Monjalon
@ 2018-05-30 19:35           ` Jerin Jacob
  2018-06-04  6:03             ` Gavin Hu
  2 siblings, 1 reply; 59+ messages in thread
From: Jerin Jacob @ 2018-05-30 19:35 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev

-----Original Message-----
> Date: Tue, 29 May 2018 18:43:36 +0800
> From: Gavin Hu <gavin.hu@arm.com>
> To: dev@dpdk.org
> CC: gavin.hu@arm.com
> Subject: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling
>  from x86
> X-Mailer: git-send-email 2.1.4
> 
> +   1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the NUMA headers and link the library respectively,
> +   if the step :ref:`argment_the_cross_toolcain_with_numa_support` was skipped therefore the toolchain was not
> +   argmented with NUMA support.
> +
> +   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h file gets

If the warnings are from numa.h then please use -isystem <numa install dir> instead of disabling RTE_DEVEL_BUILD.


> +   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
> +      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-I<numa_install_dir>/include" EXTRA_LDFLAGS=
> +      "-L<numa_install_dir>/lib -lnuma"
> +

As discussed earlier, meson cross build instruction is missing.


> diff --git a/doc/guides/linux_gsg/index.rst b/doc/guides/linux_gsg/index.rst
> index 2a7bdfe..077f930 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.1.4
> 

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-05-30 19:35           ` Jerin Jacob
@ 2018-06-04  6:03             ` Gavin Hu
  2018-06-04 12:50               ` Jerin Jacob
  0 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-04  6:03 UTC (permalink / raw)
  To: Jerin Jacob, Bruce Richardson, Thomas Monjalon; +Cc: dev

See my inline comments:

> -----Original Message-----
> From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Sent: Thursday, May 31, 2018 3:36 AM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> compiling from x86
>
> -----Original Message-----
> > Date: Tue, 29 May 2018 18:43:36 +0800
> > From: Gavin Hu <gavin.hu@arm.com>
> > To: dev@dpdk.org
> > CC: gavin.hu@arm.com
> > Subject: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> > compiling  from x86
> > X-Mailer: git-send-email 2.1.4
> >
> > +   1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the
> NUMA headers and link the library respectively,
> > +   if the step :ref:`argment_the_cross_toolcain_with_numa_support` was
> skipped therefore the toolchain was not
> > +   argmented with NUMA support.
> > +
> > +   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h file
> > + gets
>
> If the warnings are from numa.h then please use -isystem <numa install dir>
> instead of disabling RTE_DEVEL_BUILD.
>
[Gavin Hu] This is a good advice, I verified it okay and can upload a new patch.

> > +   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
> > +      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-I<numa_install_dir>/include"
> EXTRA_LDFLAGS=
> > +      "-L<numa_install_dir>/lib -lnuma"
> > +
>
> As discussed earlier, meson cross build instruction is missing.
>
[Gavin Hu] I reproduced the meson build issue Bruce reported, as shown below.
It was not introduced by gcc, nor clang, it was actually introduced by meson.build, see line #65 of http://www.dpdk.org/browse/dpdk/tree/config/meson.build
Even worse, "has_argument" is not reliable(refer here: http://mesonbuild.com/Compiler-properties.html#has-argument) for some compilers.
This is the case of gcc and clang, which caused the 4 warning options were included in the whole project, either the compiler is gcc or clang, cross or native.
This finally caused the unrecognized warning options.

I tried to disable the warning options, then the compiling got lots of noisy warnings and errors.

To fix this issue, we need to create a meson subproject  for pmdinfogen, the change is not little and I am not familiar with this.

Any comments are welcome!

[265/893] Compiling C object 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.

>
> > diff --git a/doc/guides/linux_gsg/index.rst
> > b/doc/guides/linux_gsg/index.rst index 2a7bdfe..077f930 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.1.4
> >
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-06-04  6:03             ` Gavin Hu
@ 2018-06-04 12:50               ` Jerin Jacob
  2018-06-12  1:27                 ` Gavin Hu
  0 siblings, 1 reply; 59+ messages in thread
From: Jerin Jacob @ 2018-06-04 12:50 UTC (permalink / raw)
  To: Gavin Hu; +Cc: Bruce Richardson, Thomas Monjalon, dev

-----Original Message-----
> Date: Mon, 4 Jun 2018 06:03:34 +0000
> From: Gavin Hu <Gavin.Hu@arm.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Bruce Richardson
>  <bruce.richardson@intel.com>, Thomas Monjalon <thomas@monjalon.net>
> CC: "dev@dpdk.org" <dev@dpdk.org>
> Subject: RE: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
>  compiling from x86
> 
> See my inline comments:
> 
> > -----Original Message-----
> > From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > Sent: Thursday, May 31, 2018 3:36 AM
> > To: Gavin Hu <Gavin.Hu@arm.com>
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> > compiling from x86
> >
> > -----Original Message-----
> > > Date: Tue, 29 May 2018 18:43:36 +0800
> > > From: Gavin Hu <gavin.hu@arm.com>
> > > To: dev@dpdk.org
> > > CC: gavin.hu@arm.com
> > > Subject: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> > > compiling  from x86
> > > X-Mailer: git-send-email 2.1.4
> > >
> > > +   1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include the
> > NUMA headers and link the library respectively,
> > > +   if the step :ref:`argment_the_cross_toolcain_with_numa_support` was
> > skipped therefore the toolchain was not
> > > +   argmented with NUMA support.
> > > +
> > > +   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h file
> > > + gets
> >
> > If the warnings are from numa.h then please use -isystem <numa install dir>
> > instead of disabling RTE_DEVEL_BUILD.
> >
> [Gavin Hu] This is a good advice, I verified it okay and can upload a new patch.
> 
> > > +   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
> > > +      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-I<numa_install_dir>/include"
> > EXTRA_LDFLAGS=
> > > +      "-L<numa_install_dir>/lib -lnuma"
> > > +
> >
> > As discussed earlier, meson cross build instruction is missing.
> >
> [Gavin Hu] I reproduced the meson build issue Bruce reported, as shown below.
> It was not introduced by gcc, nor clang, it was actually introduced by meson.build, see line #65 of http://www.dpdk.org/browse/dpdk/tree/config/meson.build
> Even worse, "has_argument" is not reliable(refer here: http://mesonbuild.com/Compiler-properties.html#has-argument) for some compilers.
> This is the case of gcc and clang, which caused the 4 warning options were included in the whole project, either the compiler is gcc or clang, cross or native.
> This finally caused the unrecognized warning options.
> 
> I tried to disable the warning options, then the compiling got lots of noisy warnings and errors.
> 
> To fix this issue, we need to create a meson subproject  for pmdinfogen, the change is not little and I am not familiar with this.
> 
> Any comments are welcome!


If I am not wrong, This is specific to host compiler issue with
specific version. Right? The build steps will remain same, so as far as
this patch concerned, you can add the meson build step in this patch.


> 
> [265/893] Compiling C object 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'.
> warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
> 1 warning generated.
> 
> >
> > > diff --git a/doc/guides/linux_gsg/index.rst
> > > b/doc/guides/linux_gsg/index.rst index 2a7bdfe..077f930 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.1.4
> > >
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-06-04 12:50               ` Jerin Jacob
@ 2018-06-12  1:27                 ` Gavin Hu
  2018-06-12 12:06                   ` Gavin Hu
  0 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-12  1:27 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Bruce Richardson, Thomas Monjalon, dev, nd



> -----Original Message-----
> From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Sent: Monday, June 4, 2018 8:51 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: Bruce Richardson <bruce.richardson@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> compiling from x86
> 
> -----Original Message-----
> > Date: Mon, 4 Jun 2018 06:03:34 +0000
> > From: Gavin Hu <Gavin.Hu@arm.com>
> > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Bruce Richardson
> > <bruce.richardson@intel.com>, Thomas Monjalon <thomas@monjalon.net>
> > CC: "dev@dpdk.org" <dev@dpdk.org>
> > Subject: RE: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> > compiling from x86
> >
> > See my inline comments:
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > > Sent: Thursday, May 31, 2018 3:36 AM
> > > To: Gavin Hu <Gavin.Hu@arm.com>
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for
> > > cross compiling from x86
> > >
> > > -----Original Message-----
> > > > Date: Tue, 29 May 2018 18:43:36 +0800
> > > > From: Gavin Hu <gavin.hu@arm.com>
> > > > To: dev@dpdk.org
> > > > CC: gavin.hu@arm.com
> > > > Subject: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> > > > compiling  from x86
> > > > X-Mailer: git-send-email 2.1.4
> > > >
> > > > +   1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include
> > > > + the
> > > NUMA headers and link the library respectively,
> > > > +   if the step
> > > > + :ref:`argment_the_cross_toolcain_with_numa_support` was
> > > skipped therefore the toolchain was not
> > > > +   argmented with NUMA support.
> > > > +
> > > > +   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h
> > > > + file gets
> > >
> > > If the warnings are from numa.h then please use -isystem <numa
> > > install dir> instead of disabling RTE_DEVEL_BUILD.
> > >
> > [Gavin Hu] This is a good advice, I verified it okay and can upload a new
> patch.
> >
> > > > +   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
> > > > +      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-
> I<numa_install_dir>/include"
> > > EXTRA_LDFLAGS=
> > > > +      "-L<numa_install_dir>/lib -lnuma"
> > > > +
> > >
> > > As discussed earlier, meson cross build instruction is missing.
> > >
> > [Gavin Hu] I reproduced the meson build issue Bruce reported, as shown
> below.
> > It was not introduced by gcc, nor clang, it was actually introduced by
> > meson.build, see line #65 of
> > http://www.dpdk.org/browse/dpdk/tree/config/meson.build
> > Even worse, "has_argument" is not reliable(refer here:
> http://mesonbuild.com/Compiler-properties.html#has-argument) for some
> compilers.
> > This is the case of gcc and clang, which caused the 4 warning options were
> included in the whole project, either the compiler is gcc or clang, cross or
> native.
> > This finally caused the unrecognized warning options.
> >
> > I tried to disable the warning options, then the compiling got lots of noisy
> warnings and errors.
> >
> > To fix this issue, we need to create a meson subproject  for pmdinfogen,
> the change is not little and I am not familiar with this.
> >
> > Any comments are welcome!
> 
> 
> If I am not wrong, This is specific to host compiler issue with specific version.
> Right? The build steps will remain same, so as far as this patch concerned,
> you can add the meson build step in this patch.
> 
[Gavin Hu] Hi Jerin, 
Sorry for late response, but I am still keeping working on that(some more patches are in process of internal review).
The host compiler issue with specific version was fixed by one of my patch. 

With all my patches applied:
For GNU Makefile, 
1. Host clang + cross gcc works
2. Host gcc + cross gcc works

For Meson/Ninja:
3. Host gcc + cross gcc works
4. Host clang + cross gcc does NOT work

The root cause of number 4  is clear, it is a meson build project issue. 
Both gcc and clang take all the 4 project arguments, but can NOT recognize this one: warning option '-Wno-format-truncation'
For more details , please have a look at line #56~#67 of this file:
http://www.dpdk.org/browse/dpdk/tree/config/meson.build 
http://mesonbuild.com/Compiler-properties.html#has-argument 

The compiling error:
clang  -Ibuildtools/pmdinfogen/pmdinfogen@exe -Ibuildtools/pmdinfogen -I../buildtools/pmdinfogen -Iconfig -I../config -I. -I../ -Ilib/librte_eal/common/include/arch/arm -I../lib/librte_eal/common/include/arch/arm -Ilib/librte_eal/common/include -I../lib/librte_eal/common/include -Ilib/librte_eal/common -I../lib/librte_eal/common -Ilib/librte_eal/linuxapp/eal/../../../librte_compat -I../lib/librte_eal/linuxapp/eal/../../../librte_compat -I../lib/librte_eal/linuxapp/eal/include -Ibuildtools/pmdinfogen/../../lib/librte_pci -I../buildtools/pmdinfogen/../../lib/librte_pci -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O3 -include rte_config.h -Wsign-compare -Wcast-qual -Wno-address-of-packed-member -Wno-format-truncation -MD -MQ 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o' -MF 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o.d' -o 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o' -c ../buildtools/pmdinfogen/pmdinfogen.c
error: unknown warning option '-Wno-format-truncation' [-Werror,-Wunknown-warning-option]
[265/1011] Compiling C object 'lib/rte_pipeline@sta/librte_pipeline_rte_table_action.c.o'.

Best Regards,
Gavin





> >
> > [265/893] Compiling C object
> 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'.
> > warning: unknown warning option '-Wno-format-truncation'
> > [-Wunknown-warning-option]
> > 1 warning generated.
> >
> > >
> > > > diff --git a/doc/guides/linux_gsg/index.rst
> > > > b/doc/guides/linux_gsg/index.rst index 2a7bdfe..077f930 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.1.4
> > > >

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-06-12  1:27                 ` Gavin Hu
@ 2018-06-12 12:06                   ` Gavin Hu
  2018-06-12 12:11                     ` Thomas Monjalon
  0 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-12 12:06 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Bruce Richardson, Thomas Monjalon, dev, nd

Hi Jerin, Bruce and Thomas,

To fix the meson cross build issue(host clang + cross gcc), we have to decouple clang options from gcc ones.
Currently the options for gcc and clang tightly coupled as they share a single meson project and both added to the project arguments, this is the root cause.

I have a patch to remove the specific options from the project arguments and add it individually to C_FLAGS. It basically work, but it changed a lot of meson.build files.

Any comments are welcome.

Best Regards,
Gavin

> -----Original Message-----
> From: Gavin Hu
> Sent: Tuesday, June 12, 2018 9:28 AM
> To: 'Jerin Jacob' <jerin.jacob@caviumnetworks.com>
> Cc: Bruce Richardson <bruce.richardson@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; dev@dpdk.org; nd <nd@arm.com>
> Subject: RE: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> compiling from x86
> 
> 
> 
> > -----Original Message-----
> > From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > Sent: Monday, June 4, 2018 8:51 PM
> > To: Gavin Hu <Gavin.Hu@arm.com>
> > Cc: Bruce Richardson <bruce.richardson@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross
> > compiling from x86
> >
> > -----Original Message-----
> > > Date: Mon, 4 Jun 2018 06:03:34 +0000
> > > From: Gavin Hu <Gavin.Hu@arm.com>
> > > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Bruce Richardson
> > > <bruce.richardson@intel.com>, Thomas Monjalon
> <thomas@monjalon.net>
> > > CC: "dev@dpdk.org" <dev@dpdk.org>
> > > Subject: RE: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for
> > > cross compiling from x86
> > >
> > > See my inline comments:
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > > > Sent: Thursday, May 31, 2018 3:36 AM
> > > > To: Gavin Hu <Gavin.Hu@arm.com>
> > > > Cc: dev@dpdk.org
> > > > Subject: Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for
> > > > cross compiling from x86
> > > >
> > > > -----Original Message-----
> > > > > Date: Tue, 29 May 2018 18:43:36 +0800
> > > > > From: Gavin Hu <gavin.hu@arm.com>
> > > > > To: dev@dpdk.org
> > > > > CC: gavin.hu@arm.com
> > > > > Subject: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for
> > > > > cross compiling  from x86
> > > > > X-Mailer: git-send-email 2.1.4
> > > > >
> > > > > +   1. EXTRA_CFLAGS and EXTRA_LDFLAGS should be added to include
> > > > > + the
> > > > NUMA headers and link the library respectively,
> > > > > +   if the step
> > > > > + :ref:`argment_the_cross_toolcain_with_numa_support` was
> > > > skipped therefore the toolchain was not
> > > > > +   argmented with NUMA support.
> > > > > +
> > > > > +   2. RTE_DEVEL_BUILD has to be disabled, otherwise the numa.h
> > > > > + file gets
> > > >
> > > > If the warnings are from numa.h then please use -isystem <numa
> > > > install dir> instead of disabling RTE_DEVEL_BUILD.
> > > >
> > > [Gavin Hu] This is a good advice, I verified it okay and can upload
> > > a new
> > patch.
> > >
> > > > > +   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
> > > > > +      RTE_DEVEL_BUILD=n EXTRA_CFLAGS="-
> > I<numa_install_dir>/include"
> > > > EXTRA_LDFLAGS=
> > > > > +      "-L<numa_install_dir>/lib -lnuma"
> > > > > +
> > > >
> > > > As discussed earlier, meson cross build instruction is missing.
> > > >
> > > [Gavin Hu] I reproduced the meson build issue Bruce reported, as
> > > shown
> > below.
> > > It was not introduced by gcc, nor clang, it was actually introduced
> > > by meson.build, see line #65 of
> > > http://www.dpdk.org/browse/dpdk/tree/config/meson.build
> > > Even worse, "has_argument" is not reliable(refer here:
> > http://mesonbuild.com/Compiler-properties.html#has-argument) for
> some
> > compilers.
> > > This is the case of gcc and clang, which caused the 4 warning
> > > options were
> > included in the whole project, either the compiler is gcc or clang,
> > cross or native.
> > > This finally caused the unrecognized warning options.
> > >
> > > I tried to disable the warning options, then the compiling got lots
> > > of noisy
> > warnings and errors.
> > >
> > > To fix this issue, we need to create a meson subproject  for
> > > pmdinfogen,
> > the change is not little and I am not familiar with this.
> > >
> > > Any comments are welcome!
> >
> >
> > If I am not wrong, This is specific to host compiler issue with specific
> version.
> > Right? The build steps will remain same, so as far as this patch
> > concerned, you can add the meson build step in this patch.
> >
> [Gavin Hu] Hi Jerin,
> Sorry for late response, but I am still keeping working on that(some more
> patches are in process of internal review).
> The host compiler issue with specific version was fixed by one of my patch.
> 
> With all my patches applied:
> For GNU Makefile,
> 1. Host clang + cross gcc works
> 2. Host gcc + cross gcc works
> 
> For Meson/Ninja:
> 3. Host gcc + cross gcc works
> 4. Host clang + cross gcc does NOT work
> 
> The root cause of number 4  is clear, it is a meson build project issue.
> Both gcc and clang take all the 4 project arguments, but can NOT recognize
> this one: warning option '-Wno-format-truncation'
> For more details , please have a look at line #56~#67 of this file:
> http://www.dpdk.org/browse/dpdk/tree/config/meson.build
> http://mesonbuild.com/Compiler-properties.html#has-argument
> 
> The compiling error:
> clang  -Ibuildtools/pmdinfogen/pmdinfogen@exe -Ibuildtools/pmdinfogen -
> I../buildtools/pmdinfogen -Iconfig -I../config -I. -I../ -
> Ilib/librte_eal/common/include/arch/arm -
> I../lib/librte_eal/common/include/arch/arm -Ilib/librte_eal/common/include
> -I../lib/librte_eal/common/include -Ilib/librte_eal/common -
> I../lib/librte_eal/common -Ilib/librte_eal/linuxapp/eal/../../../librte_compat -
> I../lib/librte_eal/linuxapp/eal/../../../librte_compat -
> I../lib/librte_eal/linuxapp/eal/include -
> Ibuildtools/pmdinfogen/../../lib/librte_pci -
> I../buildtools/pmdinfogen/../../lib/librte_pci -Xclang -fcolor-diagnostics -pipe
> -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O3 -include
> rte_config.h -Wsign-compare -Wcast-qual -Wno-address-of-packed-member
> -Wno-format-truncation -MD -MQ
> 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o' -MF
> 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o.d' -o
> 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o' -
> c ../buildtools/pmdinfogen/pmdinfogen.c
> error: unknown warning option '-Wno-format-truncation' [-Werror,-
> Wunknown-warning-option]
> [265/1011] Compiling C object
> 'lib/rte_pipeline@sta/librte_pipeline_rte_table_action.c.o'.
> 
> Best Regards,
> Gavin
> 
> 
> 
> 
> 
> > >
> > > [265/893] Compiling C object
> > 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'.
> > > warning: unknown warning option '-Wno-format-truncation'
> > > [-Wunknown-warning-option]
> > > 1 warning generated.
> > >
> > > >
> > > > > diff --git a/doc/guides/linux_gsg/index.rst
> > > > > b/doc/guides/linux_gsg/index.rst index 2a7bdfe..077f930 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.1.4
> > > > >

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86
  2018-06-12 12:06                   ` Gavin Hu
@ 2018-06-12 12:11                     ` Thomas Monjalon
  0 siblings, 0 replies; 59+ messages in thread
From: Thomas Monjalon @ 2018-06-12 12:11 UTC (permalink / raw)
  To: Gavin Hu; +Cc: Jerin Jacob, Bruce Richardson, dev, nd

12/06/2018 14:06, Gavin Hu:
> Hi Jerin, Bruce and Thomas,
> 
> To fix the meson cross build issue(host clang + cross gcc), we have to decouple clang options from gcc ones.
> Currently the options for gcc and clang tightly coupled as they share a single meson project and both added to the project arguments, this is the root cause.
> 
> I have a patch to remove the specific options from the project arguments and add it individually to C_FLAGS. It basically work, but it changed a lot of meson.build files.

Why is it changing many files? Can we have a fix in a common place?

Can you show your patch please?

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors  ***
  2018-05-29 10:43       ` [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc *** Gavin Hu
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 1/2] mk: fix cross build errors Gavin Hu
  2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-14  9:51         ` Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 1/7] mk: fix cross build errors Gavin Hu
                             ` (6 more replies)
  2 siblings, 7 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 UTC (permalink / raw)
  To: dev

Pre-V5 version of this patch set(two patches) was aimed to fix the
Makefile based cross compiling issue and add a guiding doc.

This V6 patch set included the fixes for meson cross compiling.

Gavin Hu (5):
  devtools: fix the Exec format error
  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                      |  22 +++-
 .../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, 188 insertions(+), 10 deletions(-)
 create mode 100644 doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst

-- 
2.11.0

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v6 1/7] mk: fix cross build errors
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 2/7] doc: add a guide doc for cross compiling from x86 Gavin Hu
                             ` (5 subsequent siblings)
  6 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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] 59+ messages in thread

* [dpdk-dev] [PATCH v6 2/7] doc: add a guide doc for cross compiling from x86
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 1/7] mk: fix cross build errors Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error Gavin Hu
                             ` (4 subsequent siblings)
  6 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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] 59+ messages in thread

* [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 1/7] mk: fix cross build errors Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 2/7] doc: add a guide doc for cross compiling from x86 Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14 10:34             ` Bruce Richardson
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 4/7] build: fix the meson build warning Gavin Hu
                             ` (3 subsequent siblings)
  6 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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.

Traceback (most recent call last): File
"/usr/share/meson/mesonbuild/mesonmain.py", line 361, in run app.generate()
File "/usr/share/meson/mesonbuild/mesonmain.py", line 150, in generate
self._generate(env) File "/usr/share/meson/mesonbuild/mesonmain.py", line
189, in _generate intr = interpreter.Interpreter(b, g) File
"/usr/share/meson/mesonbuild/interpreter.py", line 1444, in __init__
self.parse_project() File "/usr/share/meson/mesonbuild/interpreterbase.py",
line 159, in parse_project self.evaluate_codeblock(self.ast, end=1) File
"/usr/share/meson/mesonbuild/interpreterbase.py", line 195, in
evaluate_codeblock raise e File
"/usr/share/meson/mesonbuild/interpreterbase.py", line 189, in
evaluate_codeblock self.evaluate_statement(cur) File
"/usr/share/meson/mesonbuild/interpreterbase.py", line 200, in
evaluate_statement return self.function_call(cur) File
"/usr/share/meson/mesonbuild/interpreterbase.py", line 456, in
function_call return self.funcs[func_name](node, self.flatten(posargs),
kwargs) File "/usr/share/meson/mesonbuild/interpreterbase.py", line 55, in
wrapped return f(self, node, args, kwargs) File
"/usr/share/meson/mesonbuild/interpreterbase.py", line 79, in wrapped
return f(s, node_or_state, args, kwargs) File
"/usr/share/meson/mesonbuild/interpreter.py", line 1947, in func_project
self.add_languages(proj_langs, True) File
"/usr/share/meson/mesonbuild/interpreter.py", line 2078, in add_languages
(comp, cross_comp) = self.detect_compilers(lang, need_cross_compiler) File
"/usr/share/meson/mesonbuild/interpreter.py", line 2047, in
detect_compilers comp.sanity_check(self.environment.get_scratch_dir(),
self.environment) File "/usr/share/meson/mesonbuild/compilers/c.py", line
254, in sanity_check return self.sanity_check_impl(work_dir, environment,
'sanitycheckc.c', code) File "/usr/share/meson/mesonbuild/compilers/c.py",
line 247, in sanity_check_impl pe = subprocess.Popen(cmdlist) 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] 59+ messages in thread

* [dpdk-dev] [PATCH v6 4/7] build: fix the meson build warning
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
                             ` (2 preceding siblings ...)
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14 10:34             ` Bruce Richardson
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS Gavin Hu
                             ` (2 subsequent siblings)
  6 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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>
---
 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] 59+ messages in thread

* [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
                             ` (3 preceding siblings ...)
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 4/7] build: fix the meson build warning Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14 10:40             ` Bruce Richardson
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 6/7] build: fix the meson cross compile error Gavin Hu
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage Gavin Hu
  6 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 6bce3df7f..4afac76dd 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -21,7 +21,11 @@ build () # <directory> <meson options>
 		$MESON $options $srcdir $builddir
 	fi
 	echo "ninja -C $builddir"
-	ninja -C $builddir
+	if [ "$(lsb_release -d | grep -c 'CentOS')" != "0" ] ; then
+		ninja-build -C $builddir
+	else
+		ninja -C $builddir
+	fi
 }
 
 # shared and static linked builds with gcc and clang
-- 
2.11.0

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [dpdk-dev] [PATCH v6 6/7] build: fix the meson cross compile error
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
                             ` (4 preceding siblings ...)
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14 10:42             ` Bruce Richardson
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage Gavin Hu
  6 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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>
---
 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] 59+ messages in thread

* [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage
  2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
                             ` (5 preceding siblings ...)
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 6/7] build: fix the meson cross compile error Gavin Hu
@ 2018-06-14  9:51           ` Gavin Hu
  2018-06-14 10:45             ` Bruce Richardson
  6 siblings, 1 reply; 59+ messages in thread
From: Gavin Hu @ 2018-06-14  9:51 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 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 4afac76dd..74fe5abc8 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -47,7 +47,10 @@ for f in config/arm/arm*gcc ; do
 		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
+	for c in gcc clang ; do
+        export CC="ccache $c"
+        build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2)-host-$c \
+             --cross-file $f
+        unset CC
+	done
 done
-- 
2.11.0

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error Gavin Hu
@ 2018-06-14 10:34             ` Bruce Richardson
  2018-06-15  8:07               ` Gavin Hu
  0 siblings, 1 reply; 59+ messages in thread
From: Bruce Richardson @ 2018-06-14 10:34 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, stable

On Thu, Jun 14, 2018 at 05:51:23PM +0800, Gavin Hu wrote:
> 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.
> 
> Traceback (most recent call last): File
> "/usr/share/meson/mesonbuild/mesonmain.py", line 361, in run app.generate()
> File "/usr/share/meson/mesonbuild/mesonmain.py", line 150, in generate
> self._generate(env) File "/usr/share/meson/mesonbuild/mesonmain.py", line
> 189, in _generate intr = interpreter.Interpreter(b, g) File
> "/usr/share/meson/mesonbuild/interpreter.py", line 1444, in __init__
> self.parse_project() File "/usr/share/meson/mesonbuild/interpreterbase.py",
> line 159, in parse_project self.evaluate_codeblock(self.ast, end=1) File
> "/usr/share/meson/mesonbuild/interpreterbase.py", line 195, in
> evaluate_codeblock raise e File
> "/usr/share/meson/mesonbuild/interpreterbase.py", line 189, in
> evaluate_codeblock self.evaluate_statement(cur) File
> "/usr/share/meson/mesonbuild/interpreterbase.py", line 200, in
> evaluate_statement return self.function_call(cur) File
> "/usr/share/meson/mesonbuild/interpreterbase.py", line 456, in
> function_call return self.funcs[func_name](node, self.flatten(posargs),
> kwargs) File "/usr/share/meson/mesonbuild/interpreterbase.py", line 55, in
> wrapped return f(self, node, args, kwargs) File
> "/usr/share/meson/mesonbuild/interpreterbase.py", line 79, in wrapped
> return f(s, node_or_state, args, kwargs) File
> "/usr/share/meson/mesonbuild/interpreter.py", line 1947, in func_project
> self.add_languages(proj_langs, True) File
> "/usr/share/meson/mesonbuild/interpreter.py", line 2078, in add_languages
> (comp, cross_comp) = self.detect_compilers(lang, need_cross_compiler) File
> "/usr/share/meson/mesonbuild/interpreter.py", line 2047, in
> detect_compilers comp.sanity_check(self.environment.get_scratch_dir(),
> self.environment) File "/usr/share/meson/mesonbuild/compilers/c.py", line
> 254, in sanity_check return self.sanity_check_impl(work_dir, environment,
> 'sanitycheckc.c', code) File "/usr/share/meson/mesonbuild/compilers/c.py",
> line 247, in sanity_check_impl pe = subprocess.Popen(cmdlist) 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(-)
>
I think this patch is fixing the same error as this one[1], just in a slightly
longer way. [Though the addition of the message about missing the
cross-compiler is nice].

http://dpdk.org/dev/patchwork/patch/40817/

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 4/7] build: fix the meson build warning
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 4/7] build: fix the meson build warning Gavin Hu
@ 2018-06-14 10:34             ` Bruce Richardson
  0 siblings, 0 replies; 59+ messages in thread
From: Bruce Richardson @ 2018-06-14 10:34 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, stable

On Thu, Jun 14, 2018 at 05:51:24PM +0800, Gavin Hu wrote:
> 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>

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS Gavin Hu
@ 2018-06-14 10:40             ` Bruce Richardson
  2018-06-15  8:08               ` Gavin Hu
  0 siblings, 1 reply; 59+ messages in thread
From: Bruce Richardson @ 2018-06-14 10:40 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, stable

On Thu, Jun 14, 2018 at 05:51:25PM +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 | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 6bce3df7f..4afac76dd 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -21,7 +21,11 @@ build () # <directory> <meson options>
>  		$MESON $options $srcdir $builddir
>  	fi
>  	echo "ninja -C $builddir"
> -	ninja -C $builddir
> +	if [ "$(lsb_release -d | grep -c 'CentOS')" != "0" ] ; then
> +		ninja-build -C $builddir
> +	else
> +		ninja -C $builddir
> +	fi
>  }

Rather than tying this to CentOS explicitly, would it be better at the
start of the script to test e.g "which ninja" and "which ninja-build" and
use that to work out the command to use. It's possible to have ninja
installed directly from tarball on CentOS as "ninja" (as I have in my test
VM), and the binary might be called ninja-build on other systems too e.g.
RHEL, perhaps.

/Bruce

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 6/7] build: fix the meson cross compile error
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 6/7] build: fix the meson cross compile error Gavin Hu
@ 2018-06-14 10:42             ` Bruce Richardson
  0 siblings, 0 replies; 59+ messages in thread
From: Bruce Richardson @ 2018-06-14 10:42 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, stable

On Thu, Jun 14, 2018 at 05:51:26PM +0800, Gavin Hu wrote:
> 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>
> ---

Yes, I think this solution works. A cleaner fix might be to move away from
having these flags as meson project arguments, and instead manage them
directly in our files as arrays of native and cross cflags, but that can be
a job for later. As it is:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage
  2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage Gavin Hu
@ 2018-06-14 10:45             ` Bruce Richardson
  2018-06-15  8:09               ` Gavin Hu
  2018-06-15 10:23               ` Gavin Hu
  0 siblings, 2 replies; 59+ messages in thread
From: Bruce Richardson @ 2018-06-14 10:45 UTC (permalink / raw)
  To: Gavin Hu; +Cc: dev, stable

On Thu, Jun 14, 2018 at 05:51:27PM +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>
> ---
Given that the only native code we have in a cross-build is pmdinfogen,
doing two copies of each cross-build seems overkill, and makes the test
longer than it should be. I suggest that we just do one of the
cross-builds, e.g. the generic armv8 one, for both clang and gcc, and do
the others only once.

/Bruce

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error
  2018-06-14 10:34             ` Bruce Richardson
@ 2018-06-15  8:07               ` Gavin Hu
  0 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-15  8:07 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable, nd

Hi Bruce,

This patch was dropped, thanks for your review.

Best Regards,
Gavin

> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Thursday, June 14, 2018 6:34 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error
> 
> On Thu, Jun 14, 2018 at 05:51:23PM +0800, Gavin Hu wrote:
> > 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.
> >
> > Traceback (most recent call last): File
> > "/usr/share/meson/mesonbuild/mesonmain.py", line 361, in run
> > app.generate() File "/usr/share/meson/mesonbuild/mesonmain.py", line
> > 150, in generate
> > self._generate(env) File "/usr/share/meson/mesonbuild/mesonmain.py",
> > line 189, in _generate intr = interpreter.Interpreter(b, g) File
> > "/usr/share/meson/mesonbuild/interpreter.py", line 1444, in __init__
> > self.parse_project() File
> > "/usr/share/meson/mesonbuild/interpreterbase.py",
> > line 159, in parse_project self.evaluate_codeblock(self.ast, end=1)
> > File "/usr/share/meson/mesonbuild/interpreterbase.py", line 195, in
> > evaluate_codeblock raise e File
> > "/usr/share/meson/mesonbuild/interpreterbase.py", line 189, in
> > evaluate_codeblock self.evaluate_statement(cur) File
> > "/usr/share/meson/mesonbuild/interpreterbase.py", line 200, in
> > evaluate_statement return self.function_call(cur) File
> > "/usr/share/meson/mesonbuild/interpreterbase.py", line 456, in
> > function_call return self.funcs[func_name](node,
> > self.flatten(posargs),
> > kwargs) File "/usr/share/meson/mesonbuild/interpreterbase.py", line
> > 55, in wrapped return f(self, node, args, kwargs) File
> > "/usr/share/meson/mesonbuild/interpreterbase.py", line 79, in wrapped
> > return f(s, node_or_state, args, kwargs) File
> > "/usr/share/meson/mesonbuild/interpreter.py", line 1947, in
> > func_project self.add_languages(proj_langs, True) File
> > "/usr/share/meson/mesonbuild/interpreter.py", line 2078, in
> > add_languages (comp, cross_comp) = self.detect_compilers(lang,
> > need_cross_compiler) File
> > "/usr/share/meson/mesonbuild/interpreter.py", line 2047, in
> > detect_compilers comp.sanity_check(self.environment.get_scratch_dir(),
> > self.environment) File "/usr/share/meson/mesonbuild/compilers/c.py",
> > line 254, in sanity_check return self.sanity_check_impl(work_dir,
> > environment, 'sanitycheckc.c', code) File
> > "/usr/share/meson/mesonbuild/compilers/c.py",
> > line 247, in sanity_check_impl pe = subprocess.Popen(cmdlist) 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(-)
> >
> I think this patch is fixing the same error as this one[1], just in a slightly
> longer way. [Though the addition of the message about missing the cross-
> compiler is nice].
> 
> http://dpdk.org/dev/patchwork/patch/40817/

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS
  2018-06-14 10:40             ` Bruce Richardson
@ 2018-06-15  8:08               ` Gavin Hu
  0 siblings, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-15  8:08 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable



> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Thursday, June 14, 2018 6:41 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja
> command error on CentOS
>
> On Thu, Jun 14, 2018 at 05:51:25PM +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 | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/devtools/test-meson-builds.sh
> > b/devtools/test-meson-builds.sh index 6bce3df7f..4afac76dd 100755
> > --- a/devtools/test-meson-builds.sh
> > +++ b/devtools/test-meson-builds.sh
> > @@ -21,7 +21,11 @@ build () # <directory> <meson options>
> >  $MESON $options $srcdir $builddir
> >  fi
> >  echo "ninja -C $builddir"
> > -ninja -C $builddir
> > +if [ "$(lsb_release -d | grep -c 'CentOS')" != "0" ] ; then
> > +ninja-build -C $builddir
> > +else
> > +ninja -C $builddir
> > +fi
> >  }
>
> Rather than tying this to CentOS explicitly, would it be better at the start of
> the script to test e.g "which ninja" and "which ninja-build" and use that to
> work out the command to use. It's possible to have ninja installed directly
> from tarball on CentOS as "ninja" (as I have in my test VM), and the binary
> might be called ninja-build on other systems too e.g.
> RHEL, perhaps.
>
> /Bruce
[Gavin Hu] I submitted new v8 patch for this, please help review it.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage
  2018-06-14 10:45             ` Bruce Richardson
@ 2018-06-15  8:09               ` Gavin Hu
  2018-06-15 10:23               ` Gavin Hu
  1 sibling, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-15  8:09 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable



> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Thursday, June 14, 2018 6:45 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross
> compiling coverage
>
> On Thu, Jun 14, 2018 at 05:51:27PM +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>
> > ---
> Given that the only native code we have in a cross-build is pmdinfogen, doing
> two copies of each cross-build seems overkill, and makes the test longer than
> it should be. I suggest that we just do one of the cross-builds, e.g. the generic
> armv8 one, for both clang and gcc, and do the others only once.
>
> /Bruce
[Gavin Hu] I submitted a new v8 patch for this, thanks, please help review again.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage
  2018-06-14 10:45             ` Bruce Richardson
  2018-06-15  8:09               ` Gavin Hu
@ 2018-06-15 10:23               ` Gavin Hu
  1 sibling, 0 replies; 59+ messages in thread
From: Gavin Hu @ 2018-06-15 10:23 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, stable

Thanks Bruce, I submitted v10 patch set fixing the whitespace issues.

> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Thursday, June 14, 2018 6:45 PM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross
> compiling coverage
>
> On Thu, Jun 14, 2018 at 05:51:27PM +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>
> > ---
> Given that the only native code we have in a cross-build is pmdinfogen, doing
> two copies of each cross-build seems overkill, and makes the test longer than
> it should be. I suggest that we just do one of the cross-builds, e.g. the generic
> armv8 one, for both clang and gcc, and do the others only once.
>
> /Bruce
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2018-06-15 10:23 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24  3:38 [dpdk-dev] [PATCH 0/2] *** gcc cross compile dpdk *** Gavin Hu
2018-05-24  3:38 ` [dpdk-dev] [PATCH 1/2] mk: fix cross build errors Gavin Hu
2018-05-24 13:46   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-05-25  7:53     ` Gavin Hu
2018-05-24  3:38 ` [dpdk-dev] [PATCH 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
2018-05-24 10:45   ` Kovacevic, Marko
2018-05-24 10:47     ` Kovacevic, Marko
2018-05-24 11:17   ` Jerin Jacob
2018-05-24 13:20     ` Bruce Richardson
2018-05-25  7:00       ` Gavin Hu
2018-05-24 13:54     ` Thomas Monjalon
2018-05-24 17:16       ` Jerin Jacob
2018-05-24 20:31         ` Thomas Monjalon
2018-05-28  6:53 ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Gavin Hu
2018-05-28  6:53   ` [dpdk-dev] [PATCH v2 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
2018-05-28 13:25     ` Bruce Richardson
2018-05-29  1:24       ` Gavin Hu
2018-05-28 16:01     ` Kovacevic, Marko
2018-05-28 13:24   ` [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors Bruce Richardson
2018-05-29  1:22     ` Gavin Hu
2018-05-29 14:45     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-05-29 15:00       ` Bruce Richardson
2018-05-29 16:20         ` Gavin Hu
2018-05-29 19:53           ` Thomas Monjalon
2018-05-29  6:51   ` [dpdk-dev] [PATCH v3 " Gavin Hu
2018-05-29  6:51     ` [dpdk-dev] [PATCH v3 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
2018-05-29  7:21     ` [dpdk-dev] [PATCH v4 0/2] *** cross gcc fix and guide doc *** Gavin Hu
2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 1/2] mk: fix cross build errors Gavin Hu
2018-05-29  7:21       ` [dpdk-dev] [PATCH v4 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
2018-05-29  8:39         ` Kovacevic, Marko
2018-05-29 10:43       ` [dpdk-dev] [PATCH v5 0/2] *** cross gcc compile fix and add a guide doc *** Gavin Hu
2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 1/2] mk: fix cross build errors Gavin Hu
2018-05-29 15:09           ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-05-29 10:43         ` [dpdk-dev] [PATCH v5 2/2] doc: add a guide doc for cross compiling from x86 Gavin Hu
2018-05-29 13:33           ` Kovacevic, Marko
2018-05-30 19:16           ` Thomas Monjalon
2018-05-30 19:35           ` Jerin Jacob
2018-06-04  6:03             ` Gavin Hu
2018-06-04 12:50               ` Jerin Jacob
2018-06-12  1:27                 ` Gavin Hu
2018-06-12 12:06                   ` Gavin Hu
2018-06-12 12:11                     ` Thomas Monjalon
2018-06-14  9:51         ` [dpdk-dev] [PATCH v6 0/7] *** fix the cross compile errors *** Gavin Hu
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 1/7] mk: fix cross build errors Gavin Hu
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 2/7] doc: add a guide doc for cross compiling from x86 Gavin Hu
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 3/7] devtools: fix the Exec format error Gavin Hu
2018-06-14 10:34             ` Bruce Richardson
2018-06-15  8:07               ` Gavin Hu
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 4/7] build: fix the meson build warning Gavin Hu
2018-06-14 10:34             ` Bruce Richardson
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 5/7] devtools: fix the missing ninja command error on CentOS Gavin Hu
2018-06-14 10:40             ` Bruce Richardson
2018-06-15  8:08               ` Gavin Hu
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 6/7] build: fix the meson cross compile error Gavin Hu
2018-06-14 10:42             ` Bruce Richardson
2018-06-14  9:51           ` [dpdk-dev] [PATCH v6 7/7] devtools: expand meson cross compiling coverage Gavin Hu
2018-06-14 10:45             ` Bruce Richardson
2018-06-15  8:09               ` Gavin Hu
2018-06-15 10:23               ` Gavin Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).