DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] aarch64 clang cross compilation
@ 2020-10-01 10:20 Juraj Linkeš
  2020-10-01 10:20 ` [dpdk-dev] [PATCH 1/2] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
                   ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:20 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Use clang/LLVM toolchain with gcc stdlib to cross compile aarch64
target.

Juraj Linkeš (2):
  ci: add aarch64 clang cross-compilation builds
  doc: add clang to aarch64 cross build guide

 .ci/linux-build.sh                            |   9 +-
 .travis.yml                                   |  22 ++-
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 3 files changed, 159 insertions(+), 55 deletions(-)

-- 
2.20.1


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

* [dpdk-dev] [PATCH 1/2] ci: add aarch64 clang cross-compilation builds
  2020-10-01 10:20 [dpdk-dev] [PATCH 0/2] aarch64 clang cross compilation Juraj Linkeš
@ 2020-10-01 10:20 ` Juraj Linkeš
  2020-10-01 10:20 ` [dpdk-dev] [PATCH 2/2] doc: add clang to aarch64 cross build guide Juraj Linkeš
  2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
  2 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:20 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Mirror the existing gcc jobs - build static and shared libs.
Use arm64_armv8_linux_clang meson cross file.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .ci/linux-build.sh |  9 +++++++--
 .travis.yml        | 22 ++++++++++++++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d079801d7..aac339399 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -28,11 +28,16 @@ install_libabigail() {
     rm ${version}.tar.gz
 }
 
-if [ "$AARCH64" = "1" ]; then
+if [ "$AARCH64_GCC" = "1" ]; then
     # convert the arch specifier
     OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
 fi
 
+if [ "$AARCH64_CLANG" = "1" ]; then
+    # convert the arch specifier
+    OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_clang"
+fi
+
 if [ "$BUILD_DOCS" = "1" ]; then
     OPTS="$OPTS -Denable_docs=true"
 fi
@@ -53,7 +58,7 @@ OPTS="$OPTS --buildtype=debugoptimized"
 meson build --werror $OPTS
 ninja -C build
 
-if [ "$AARCH64" != "1" ]; then
+if [ "$AARCH64_GCC" != "1" ] && [ "$AARCH64_CLANG" != 1 ]; then
     devtools/test-null.sh
 fi
 
diff --git a/.travis.yml b/.travis.yml
index d6eeab371..1f769d823 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,10 @@ _aarch64_packages: &aarch64_packages
   - *required_packages
   - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
 
+_aarch64_clang_packages: &aarch64_clang_packages
+  - *required_packages
+  - [libgcc-8-dev-arm64-cross, libatomic1-arm64-cross, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
+
 _build_32b_packages: &build_32b_packages
   - *required_packages
   - [gcc-multilib]
@@ -69,20 +73,34 @@ jobs:
         packages:
           - *build_32b_packages
   # x86_64 cross-compiling aarch64 jobs
-  - env: DEF_LIB="static" AARCH64=1
+  - env: DEF_LIB="static" AARCH64_GCC=1
     arch: amd64
     compiler: gcc
     addons:
       apt:
         packages:
           - *aarch64_packages
-  - env: DEF_LIB="shared" AARCH64=1
+  - env: DEF_LIB="shared" AARCH64_GCC=1
     arch: amd64
     compiler: gcc
     addons:
       apt:
         packages:
           - *aarch64_packages
+  - env: DEF_LIB="static" AARCH64_CLANG=1
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
+  - env: DEF_LIB="shared" AARCH64_CLANG=1
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
   # aarch64 gcc jobs
   - env: DEF_LIB="static"
     arch: arm64
-- 
2.20.1


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

* [dpdk-dev] [PATCH 2/2] doc: add clang to aarch64 cross build guide
  2020-10-01 10:20 [dpdk-dev] [PATCH 0/2] aarch64 clang cross compilation Juraj Linkeš
  2020-10-01 10:20 ` [dpdk-dev] [PATCH 1/2] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
@ 2020-10-01 10:20 ` Juraj Linkeš
  2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
  2 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:20 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Reorganize and update the aarch64 cross guide with clang cross
compilation. Update the GNU toolchain version which clang also uses.
Reorganize into common part, GNU part and clang part.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 1 file changed, 132 insertions(+), 51 deletions(-)

diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
index 8a1d0e88b..cd10be2ef 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -1,101 +1,182 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2018 ARM Corporation.
+    Copyright(c) 2020 ARM Corporation.
 
-Cross compile DPDK for ARM64
-============================
+Cross compiling 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.
+   like with x86), it is also possible to cross compile DPDK for ARM64.
+   An ARM64 cross compiler GNU toolchain or an LLVM/clang toolchain
+   may be used for cross-compilation.
 
-Obtain the cross tool chain
----------------------------
-The latest cross compile tool chain can be downloaded from:
+
+Prerequisites
+-------------
+
+NUMA 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.13 -b v2.0.13
+   ./autogen.sh
+   autoconf -i
+   ./configure --host=aarch64-linux-gnu CC=<compiler> --prefix=<numa install dir>
+   make install
+
+.. note::
+
+   The compiler above can be either aarch64-linux-gnu-gcc or clang.
+   See below for information on how to get the compiler of your choice.
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+Meson prerequisites
+~~~~~~~~~~~~~~~~~~~
+
+Meson depends on pkgconfig to find the dependencies.
+The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
+To install it in Ubuntu::
+
+   sudo apt install pkg-config-aarch64-linux-gnu
+
+
+GNU toolchain
+-------------
+
+.. _obtain_GNU_toolchain:
+
+Obtain the cross toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest GNU cross compiler toolchain can be downloaded from:
 https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads.
 
 It is always recommended to check and get the latest compiler tool from the page and use
-it to generate better code. As of this writing 8.3-2019.03 is the newest, the following
+it to generate better code. As of this writing 9.2-2019.12 is the newest, the following
 description is an example of this version.
 
 .. code-block:: console
 
-   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
+   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
 
 Unzip and add into the PATH
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. code-block:: console
 
-   tar -xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
-   export PATH=$PATH:<cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin
+   tar -xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
+   export PATH=$PATH:<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin
 
 .. note::
 
    For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/
 
-.. _arm_cross_build_getting_the_prerequisite_library:
+.. _augment_the_gnu_toolchain_with_numa_support:
 
-Getting the prerequisite library
---------------------------------
-
-NUMA is required by most modern machines, not needed for non-NUMA architectures.
+Augment the GNU toolchain with NUMA support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
-   otherwise the compilation will fail with errors.
+   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
 
 .. code-block:: console
 
-   git clone https://github.com/numactl/numactl.git
-   cd numactl
-   git checkout v2.0.13 -b v2.0.13
-   ./autogen.sh
-   autoconf -i
-   ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=<numa install dir>
-   make install
+   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/usr/include/
+   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
+   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
 
-The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+Cross Compiling DPDK with GNU toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+   meson cross-build --cross-file <target_machine_configuration>
+   ninja -C cross-build
+
+For example if the target machine is aarch64 we can use the following
+command::
 
-.. _augment_the_cross_toolchain_with_numa_support:
+   meson aarch64-build-gcc --cross-file config/arm/arm64_armv8_linux_gcc
+   ninja -C aarch64-build-gcc
 
-Augment the cross toolchain with NUMA support
----------------------------------------------
+
+LLVM/Clang toolchain
+--------------------
+
+Obtain the cross tool chain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest LLVM/Clang cross compiler toolchain can be downloaded from:
+https://developer.arm.com/tools-and-software/open-source-software/developer-tools/llvm-toolchain.
+
+.. code-block:: console
+
+   # Ubuntu binaries
+   wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+
+The LLVM/Clang toolchain does not implement the standard c library. The GNU toolchain
+ships an implementation we can use. Refer to obtain_GNU_toolchain_ to get the
+GNU toolchain.
+
+Unzip and add into the PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+   tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+   export PATH=$PATH:<cross_install_dir>/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin
+
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+   To use the NUMA library follow the same steps as for
+   augment_the_gnu_toolchain_with_numa_support_.
 
-Copy the NUMA header files and lib to the cross compiler's directories:
+The paths to GNU stdlib must be specified in a cross file. Augmenting the default
+cross-file's c_args and c_link_args config/arm/arm64_armv8_linux_clang_ubuntu18.04 would look like this:
 
 .. code-block:: console
 
-   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include/
-   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
-   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
+   ...
+   c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
+   c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
 
-.. _configure_and_cross_compile_dpdk_build:
+Assuming the file with augmented c_args and c_link_args is named arm64_armv8_linux_clang,
+use the following command to cross-compile DPDK for your target machine::
 
-Cross Compiling DPDK
---------------------
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang
+   ninja -C aarch64-build-clang
 
-Meson depends on pkgconfig to find the dependencies.
-The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
-To install it in Ubuntu::
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson on Ubuntu18.04
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   sudo apt-get install pkg-config-aarch64-linux-gnu
+On most popular Linux distribution it's not necessary to download
+the toolchains, but rather use the packages provided by said distributions.
+On Ubuntu18.04, you'll need these packages:
 
-To cross-compile DPDK on a desired target machine we can use the following
-command::
+.. code-block:: console
 
-	meson cross-build --cross-file <target_machine_configuration>
-	ninja -C cross-build
+   sudo apt-get install pkg-config-aarch64-linux-gnu clang llvm llvm-dev lld
+   libc6-dev-arm64-cross libatomic1-arm64-cross libgcc-8-dev-arm64-cross
 
-For example if the target machine is arm64 we can use the following
-command::
+Use the following command to cross-compile DPDK for your target machine::
 
-	meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc
-	ninja -C arm64-build
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang_ubuntu18.04
+   ninja -C aarch64-build-clang
-- 
2.20.1


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

* [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation
  2020-10-01 10:20 [dpdk-dev] [PATCH 0/2] aarch64 clang cross compilation Juraj Linkeš
  2020-10-01 10:20 ` [dpdk-dev] [PATCH 1/2] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
  2020-10-01 10:20 ` [dpdk-dev] [PATCH 2/2] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2020-10-01 10:30 ` Juraj Linkeš
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
                     ` (3 more replies)
  2 siblings, 4 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:30 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Use clang/LLVM toolchain with gcc stdlib to cross compile aarch64
target.

Juraj Linkeš (3):
  build: add aarch64 clang to meson cross-compile
  ci: add aarch64 clang cross-compilation builds
  doc: add clang to aarch64 cross build guide

 .ci/linux-build.sh                            |   9 +-
 .travis.yml                                   |  22 ++-
 config/arm/arm64_armv8_linux_clang_ubuntu1804 |  20 ++
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 4 files changed, 179 insertions(+), 55 deletions(-)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

-- 
2.20.1


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

* [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
@ 2020-10-01 10:30   ` Juraj Linkeš
  2020-10-04  8:29     ` Jerin Jacob
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:30 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

diff --git a/config/arm/arm64_armv8_linux_clang_ubuntu1804 b/config/arm/arm64_armv8_linux_clang_ubuntu1804
new file mode 100644
index 000000000..67f475eb0
--- /dev/null
+++ b/config/arm/arm64_armv8_linux_clang_ubuntu1804
@@ -0,0 +1,20 @@
+[binaries]
+c = 'clang'
+cpp = 'clang++'
+ar = 'llvm-ar'
+strip = 'llvm-strip'
+llvm-config = 'llvm-config'
+pcap-config = 'llvm-config'
+pkgconfig = 'aarch64-linux-gnu-pkg-config'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'aarch64'
+cpu = 'armv8-a'
+endian = 'little'
+
+[properties]
+implementor_id = 'generic'
+implementor_pn = 'default'
+c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '/usr/aarch64-linux-gnu', '--gcc-toolchain=/usr']
+c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld']
-- 
2.20.1


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

* [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds
  2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2020-10-01 10:30   ` Juraj Linkeš
  2020-10-01 13:31     ` Aaron Conole
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
  2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
  3 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:30 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Mirror the existing gcc jobs - build static and shared libs.
Use arm64_armv8_linux_clang_ubuntu1804 meson cross file.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .ci/linux-build.sh |  9 +++++++--
 .travis.yml        | 22 ++++++++++++++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d079801d7..137f51e91 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -28,11 +28,16 @@ install_libabigail() {
     rm ${version}.tar.gz
 }
 
-if [ "$AARCH64" = "1" ]; then
+if [ "$AARCH64_GCC" = "1" ]; then
     # convert the arch specifier
     OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
 fi
 
+if [ "$AARCH64_CLANG" = "1" ]; then
+    # convert the arch specifier
+    OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804"
+fi
+
 if [ "$BUILD_DOCS" = "1" ]; then
     OPTS="$OPTS -Denable_docs=true"
 fi
@@ -53,7 +58,7 @@ OPTS="$OPTS --buildtype=debugoptimized"
 meson build --werror $OPTS
 ninja -C build
 
-if [ "$AARCH64" != "1" ]; then
+if [ "$AARCH64_GCC" != "1" ] && [ "$AARCH64_CLANG" != 1 ]; then
     devtools/test-null.sh
 fi
 
diff --git a/.travis.yml b/.travis.yml
index d6eeab371..1f769d823 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,10 @@ _aarch64_packages: &aarch64_packages
   - *required_packages
   - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
 
+_aarch64_clang_packages: &aarch64_clang_packages
+  - *required_packages
+  - [libgcc-8-dev-arm64-cross, libatomic1-arm64-cross, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
+
 _build_32b_packages: &build_32b_packages
   - *required_packages
   - [gcc-multilib]
@@ -69,20 +73,34 @@ jobs:
         packages:
           - *build_32b_packages
   # x86_64 cross-compiling aarch64 jobs
-  - env: DEF_LIB="static" AARCH64=1
+  - env: DEF_LIB="static" AARCH64_GCC=1
     arch: amd64
     compiler: gcc
     addons:
       apt:
         packages:
           - *aarch64_packages
-  - env: DEF_LIB="shared" AARCH64=1
+  - env: DEF_LIB="shared" AARCH64_GCC=1
     arch: amd64
     compiler: gcc
     addons:
       apt:
         packages:
           - *aarch64_packages
+  - env: DEF_LIB="static" AARCH64_CLANG=1
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
+  - env: DEF_LIB="shared" AARCH64_CLANG=1
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
   # aarch64 gcc jobs
   - env: DEF_LIB="static"
     arch: arm64
-- 
2.20.1


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

* [dpdk-dev] [PATCH v2 3/3] doc: add clang to aarch64 cross build guide
  2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
@ 2020-10-01 10:30   ` Juraj Linkeš
  2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
  3 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 10:30 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Reorganize and update the aarch64 cross guide with clang cross
compilation. Update the GNU toolchain version which clang also uses.
Reorganize into common part, GNU part and clang part.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 1 file changed, 132 insertions(+), 51 deletions(-)

diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
index 8a1d0e88b..c936a3d7a 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -1,101 +1,182 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2018 ARM Corporation.
+    Copyright(c) 2020 ARM Corporation.
 
-Cross compile DPDK for ARM64
-============================
+Cross compiling 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.
+   like with x86), it is also possible to cross compile DPDK for ARM64.
+   An ARM64 cross compiler GNU toolchain or an LLVM/clang toolchain
+   may be used for cross-compilation.
 
-Obtain the cross tool chain
----------------------------
-The latest cross compile tool chain can be downloaded from:
+
+Prerequisites
+-------------
+
+NUMA 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.13 -b v2.0.13
+   ./autogen.sh
+   autoconf -i
+   ./configure --host=aarch64-linux-gnu CC=<compiler> --prefix=<numa install dir>
+   make install
+
+.. note::
+
+   The compiler above can be either aarch64-linux-gnu-gcc or clang.
+   See below for information on how to get the compiler of your choice.
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+Meson prerequisites
+~~~~~~~~~~~~~~~~~~~
+
+Meson depends on pkgconfig to find the dependencies.
+The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
+To install it in Ubuntu::
+
+   sudo apt install pkg-config-aarch64-linux-gnu
+
+
+GNU toolchain
+-------------
+
+.. _obtain_GNU_toolchain:
+
+Obtain the cross toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest GNU cross compiler toolchain can be downloaded from:
 https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads.
 
 It is always recommended to check and get the latest compiler tool from the page and use
-it to generate better code. As of this writing 8.3-2019.03 is the newest, the following
+it to generate better code. As of this writing 9.2-2019.12 is the newest, the following
 description is an example of this version.
 
 .. code-block:: console
 
-   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
+   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
 
 Unzip and add into the PATH
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. code-block:: console
 
-   tar -xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
-   export PATH=$PATH:<cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin
+   tar -xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
+   export PATH=$PATH:<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin
 
 .. note::
 
    For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/
 
-.. _arm_cross_build_getting_the_prerequisite_library:
+.. _augment_the_gnu_toolchain_with_numa_support:
 
-Getting the prerequisite library
---------------------------------
-
-NUMA is required by most modern machines, not needed for non-NUMA architectures.
+Augment the GNU toolchain with NUMA support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
-   otherwise the compilation will fail with errors.
+   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
 
 .. code-block:: console
 
-   git clone https://github.com/numactl/numactl.git
-   cd numactl
-   git checkout v2.0.13 -b v2.0.13
-   ./autogen.sh
-   autoconf -i
-   ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=<numa install dir>
-   make install
+   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/usr/include/
+   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
+   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
 
-The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+Cross Compiling DPDK with GNU toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+   meson cross-build --cross-file <target_machine_configuration>
+   ninja -C cross-build
+
+For example if the target machine is aarch64 we can use the following
+command::
 
-.. _augment_the_cross_toolchain_with_numa_support:
+   meson aarch64-build-gcc --cross-file config/arm/arm64_armv8_linux_gcc
+   ninja -C aarch64-build-gcc
 
-Augment the cross toolchain with NUMA support
----------------------------------------------
+
+LLVM/Clang toolchain
+--------------------
+
+Obtain the cross tool chain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest LLVM/Clang cross compiler toolchain can be downloaded from:
+https://developer.arm.com/tools-and-software/open-source-software/developer-tools/llvm-toolchain.
+
+.. code-block:: console
+
+   # Ubuntu binaries
+   wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+
+The LLVM/Clang toolchain does not implement the standard c library. The GNU toolchain
+ships an implementation we can use. Refer to obtain_GNU_toolchain_ to get the
+GNU toolchain.
+
+Unzip and add into the PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+   tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+   export PATH=$PATH:<cross_install_dir>/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin
+
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+   To use the NUMA library follow the same steps as for
+   augment_the_gnu_toolchain_with_numa_support_.
 
-Copy the NUMA header files and lib to the cross compiler's directories:
+The paths to GNU stdlib must be specified in a cross file. Augmenting the default
+cross-file's c_args and c_link_args config/arm/arm64_armv8_linux_clang_ubuntu1804 would look like this:
 
 .. code-block:: console
 
-   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include/
-   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
-   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
+   ...
+   c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
+   c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
 
-.. _configure_and_cross_compile_dpdk_build:
+Assuming the file with augmented c_args and c_link_args is named arm64_armv8_linux_clang,
+use the following command to cross-compile DPDK for your target machine::
 
-Cross Compiling DPDK
---------------------
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang
+   ninja -C aarch64-build-clang
 
-Meson depends on pkgconfig to find the dependencies.
-The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
-To install it in Ubuntu::
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson on Ubuntu 18.04
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   sudo apt-get install pkg-config-aarch64-linux-gnu
+On most popular Linux distribution it's not necessary to download
+the toolchains, but rather use the packages provided by said distributions.
+On Ubuntu 18.04, you'll need these packages:
 
-To cross-compile DPDK on a desired target machine we can use the following
-command::
+.. code-block:: console
 
-	meson cross-build --cross-file <target_machine_configuration>
-	ninja -C cross-build
+   sudo apt-get install pkg-config-aarch64-linux-gnu clang llvm llvm-dev lld
+   libc6-dev-arm64-cross libatomic1-arm64-cross libgcc-8-dev-arm64-cross
 
-For example if the target machine is arm64 we can use the following
-command::
+Use the following command to cross-compile DPDK for your target machine::
 
-	meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc
-	ninja -C arm64-build
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804
+   ninja -C aarch64-build-clang
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
@ 2020-10-01 13:31     ` Aaron Conole
  2020-10-01 14:43       ` Juraj Linkeš
  0 siblings, 1 reply; 35+ messages in thread
From: Aaron Conole @ 2020-10-01 13:31 UTC (permalink / raw)
  To: Juraj Linkeš; +Cc: thomas, david.marchand, maicolgabriel, dev

Juraj Linkeš <juraj.linkes@pantheon.tech> writes:

> Mirror the existing gcc jobs - build static and shared libs.
> Use arm64_armv8_linux_clang_ubuntu1804 meson cross file.
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  .ci/linux-build.sh |  9 +++++++--
>  .travis.yml        | 22 ++++++++++++++++++++--
>  2 files changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
> index d079801d7..137f51e91 100755
> --- a/.ci/linux-build.sh
> +++ b/.ci/linux-build.sh
> @@ -28,11 +28,16 @@ install_libabigail() {
>      rm ${version}.tar.gz
>  }
>  
> -if [ "$AARCH64" = "1" ]; then
> +if [ "$AARCH64_GCC" = "1" ]; then

Why do we need to do this?

CC_FOR_BUILD and CC should be either 'gcc' or 'clang' - so we could just
key off of those instead of having to do this new set of variables, yes?

>      # convert the arch specifier
>      OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
>  fi
>  
> +if [ "$AARCH64_CLANG" = "1" ]; then
> +    # convert the arch specifier
> +    OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804"
> +fi
> +
>  if [ "$BUILD_DOCS" = "1" ]; then
>      OPTS="$OPTS -Denable_docs=true"
>  fi
> @@ -53,7 +58,7 @@ OPTS="$OPTS --buildtype=debugoptimized"
>  meson build --werror $OPTS
>  ninja -C build
>  
> -if [ "$AARCH64" != "1" ]; then
> +if [ "$AARCH64_GCC" != "1" ] && [ "$AARCH64_CLANG" != 1 ]; then
>      devtools/test-null.sh
>  fi
>  
> diff --git a/.travis.yml b/.travis.yml
> index d6eeab371..1f769d823 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -18,6 +18,10 @@ _aarch64_packages: &aarch64_packages
>    - *required_packages
>    - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
>  
> +_aarch64_clang_packages: &aarch64_clang_packages
> +  - *required_packages
> +  - [libgcc-8-dev-arm64-cross, libatomic1-arm64-cross, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
> +
>  _build_32b_packages: &build_32b_packages
>    - *required_packages
>    - [gcc-multilib]
> @@ -69,20 +73,34 @@ jobs:
>          packages:
>            - *build_32b_packages
>    # x86_64 cross-compiling aarch64 jobs
> -  - env: DEF_LIB="static" AARCH64=1
> +  - env: DEF_LIB="static" AARCH64_GCC=1
>      arch: amd64
>      compiler: gcc
>      addons:
>        apt:
>          packages:
>            - *aarch64_packages
> -  - env: DEF_LIB="shared" AARCH64=1
> +  - env: DEF_LIB="shared" AARCH64_GCC=1
>      arch: amd64
>      compiler: gcc
>      addons:
>        apt:
>          packages:
>            - *aarch64_packages
> +  - env: DEF_LIB="static" AARCH64_CLANG=1
> +    arch: amd64
> +    compiler: clang
> +    addons:
> +      apt:
> +        packages:
> +          - *aarch64_clang_packages
> +  - env: DEF_LIB="shared" AARCH64_CLANG=1
> +    arch: amd64
> +    compiler: clang
> +    addons:
> +      apt:
> +        packages:
> +          - *aarch64_clang_packages
>    # aarch64 gcc jobs
>    - env: DEF_LIB="static"
>      arch: arm64


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

* Re: [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds
  2020-10-01 13:31     ` Aaron Conole
@ 2020-10-01 14:43       ` Juraj Linkeš
  0 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-01 14:43 UTC (permalink / raw)
  To: Aaron Conole; +Cc: thomas, david.marchand, maicolgabriel, dev



> -----Original Message-----
> From: Aaron Conole <aconole@redhat.com>
> Sent: Thursday, October 1, 2020 3:32 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: thomas@monjalon.net; david.marchand@redhat.com;
> maicolgabriel@hotmail.com; dev@dpdk.org
> Subject: Re: [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds
> 
> Juraj Linkeš <juraj.linkes@pantheon.tech> writes:
> 
> > Mirror the existing gcc jobs - build static and shared libs.
> > Use arm64_armv8_linux_clang_ubuntu1804 meson cross file.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > ---
> >  .ci/linux-build.sh |  9 +++++++--
> >  .travis.yml        | 22 ++++++++++++++++++++--
> >  2 files changed, 27 insertions(+), 4 deletions(-)
> >
> > diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index
> > d079801d7..137f51e91 100755
> > --- a/.ci/linux-build.sh
> > +++ b/.ci/linux-build.sh
> > @@ -28,11 +28,16 @@ install_libabigail() {
> >      rm ${version}.tar.gz
> >  }
> >
> > -if [ "$AARCH64" = "1" ]; then
> > +if [ "$AARCH64_GCC" = "1" ]; then
> 
> Why do we need to do this?
> 
> CC_FOR_BUILD and CC should be either 'gcc' or 'clang' - so we could just key off
> of those instead of having to do this new set of variables, yes?
> 

I didn't think of these variables. I'll make use of them, that's better, thanks.

> >      # convert the arch specifier
> >      OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
> >  fi
> >
> > +if [ "$AARCH64_CLANG" = "1" ]; then
> > +    # convert the arch specifier
> > +    OPTS="$OPTS --cross-file
> config/arm/arm64_armv8_linux_clang_ubuntu1804"
> > +fi
> > +
> >  if [ "$BUILD_DOCS" = "1" ]; then
> >      OPTS="$OPTS -Denable_docs=true"
> >  fi
> > @@ -53,7 +58,7 @@ OPTS="$OPTS --buildtype=debugoptimized"
> >  meson build --werror $OPTS
> >  ninja -C build
> >
> > -if [ "$AARCH64" != "1" ]; then
> > +if [ "$AARCH64_GCC" != "1" ] && [ "$AARCH64_CLANG" != 1 ]; then
> >      devtools/test-null.sh
> >  fi
> >
> > diff --git a/.travis.yml b/.travis.yml index d6eeab371..1f769d823
> > 100644
> > --- a/.travis.yml
> > +++ b/.travis.yml
> > @@ -18,6 +18,10 @@ _aarch64_packages: &aarch64_packages
> >    - *required_packages
> >    - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross,
> > pkg-config-aarch64-linux-gnu]
> >
> > +_aarch64_clang_packages: &aarch64_clang_packages
> > +  - *required_packages
> > +  - [libgcc-8-dev-arm64-cross, libatomic1-arm64-cross,
> > +libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
> > +
> >  _build_32b_packages: &build_32b_packages
> >    - *required_packages
> >    - [gcc-multilib]
> > @@ -69,20 +73,34 @@ jobs:
> >          packages:
> >            - *build_32b_packages
> >    # x86_64 cross-compiling aarch64 jobs
> > -  - env: DEF_LIB="static" AARCH64=1
> > +  - env: DEF_LIB="static" AARCH64_GCC=1
> >      arch: amd64
> >      compiler: gcc
> >      addons:
> >        apt:
> >          packages:
> >            - *aarch64_packages
> > -  - env: DEF_LIB="shared" AARCH64=1
> > +  - env: DEF_LIB="shared" AARCH64_GCC=1
> >      arch: amd64
> >      compiler: gcc
> >      addons:
> >        apt:
> >          packages:
> >            - *aarch64_packages
> > +  - env: DEF_LIB="static" AARCH64_CLANG=1
> > +    arch: amd64
> > +    compiler: clang
> > +    addons:
> > +      apt:
> > +        packages:
> > +          - *aarch64_clang_packages
> > +  - env: DEF_LIB="shared" AARCH64_CLANG=1
> > +    arch: amd64
> > +    compiler: clang
> > +    addons:
> > +      apt:
> > +        packages:
> > +          - *aarch64_clang_packages
> >    # aarch64 gcc jobs
> >    - env: DEF_LIB="static"
> >      arch: arm64
> 


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

* [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation
  2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
                     ` (2 preceding siblings ...)
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2020-10-02  9:38   ` Juraj Linkeš
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
                       ` (3 more replies)
  3 siblings, 4 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-02  9:38 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Use clang/LLVM toolchain with gcc stdlib to cross compile aarch64
target.

v3:
Removed AARCH_GCC and AARCH_CLANG variables in favor of CC_FOR_BUILD.

Juraj Linkeš (3):
  build: add aarch64 clang to meson cross-compile
  ci: add aarch64 clang cross-compilation builds
  doc: add clang to aarch64 cross build guide

 .ci/linux-build.sh                            |   6 +-
 .travis.yml                                   |  18 ++
 config/arm/arm64_armv8_linux_clang_ubuntu1804 |  20 ++
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 4 files changed, 175 insertions(+), 52 deletions(-)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

-- 
2.20.1


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

* [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
@ 2020-10-02  9:38     ` Juraj Linkeš
  2020-12-22  9:58       ` Ruifeng Wang
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-02  9:38 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

diff --git a/config/arm/arm64_armv8_linux_clang_ubuntu1804 b/config/arm/arm64_armv8_linux_clang_ubuntu1804
new file mode 100644
index 000000000..67f475eb0
--- /dev/null
+++ b/config/arm/arm64_armv8_linux_clang_ubuntu1804
@@ -0,0 +1,20 @@
+[binaries]
+c = 'clang'
+cpp = 'clang++'
+ar = 'llvm-ar'
+strip = 'llvm-strip'
+llvm-config = 'llvm-config'
+pcap-config = 'llvm-config'
+pkgconfig = 'aarch64-linux-gnu-pkg-config'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'aarch64'
+cpu = 'armv8-a'
+endian = 'little'
+
+[properties]
+implementor_id = 'generic'
+implementor_pn = 'default'
+c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '/usr/aarch64-linux-gnu', '--gcc-toolchain=/usr']
+c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld']
-- 
2.20.1


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

* [dpdk-dev] [PATCH v3 2/3] ci: add aarch64 clang cross-compilation builds
  2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2020-10-02  9:38     ` Juraj Linkeš
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
  2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
  3 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-02  9:38 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Mirror the existing gcc jobs - build static and shared libs.
Use arm64_armv8_linux_clang_ubuntu1804 meson cross file.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .ci/linux-build.sh |  6 +++++-
 .travis.yml        | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d079801d7..d9bdd1503 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -30,7 +30,11 @@ install_libabigail() {
 
 if [ "$AARCH64" = "1" ]; then
     # convert the arch specifier
-    OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
+    if [ "$CC_FOR_BUILD" = "gcc" ]; then
+    	OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
+    elif [ "$CC_FOR_BUILD" = "clang" ]; then
+    	OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804"
+    fi
 fi
 
 if [ "$BUILD_DOCS" = "1" ]; then
diff --git a/.travis.yml b/.travis.yml
index d6eeab371..cc3d49218 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,10 @@ _aarch64_packages: &aarch64_packages
   - *required_packages
   - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
 
+_aarch64_clang_packages: &aarch64_clang_packages
+  - *required_packages
+  - [libgcc-8-dev-arm64-cross, libatomic1-arm64-cross, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
+
 _build_32b_packages: &build_32b_packages
   - *required_packages
   - [gcc-multilib]
@@ -83,6 +87,20 @@ jobs:
       apt:
         packages:
           - *aarch64_packages
+  - env: DEF_LIB="static" AARCH64=1
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
+  - env: DEF_LIB="shared" AARCH64=1
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
   # aarch64 gcc jobs
   - env: DEF_LIB="static"
     arch: arm64
-- 
2.20.1


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

* [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide
  2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
@ 2020-10-02  9:38     ` Juraj Linkeš
  2020-12-22  7:34       ` Ruifeng Wang
  2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
  3 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-02  9:38 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, Juraj Linkeš

Reorganize and update the aarch64 cross guide with clang cross
compilation. Update the GNU toolchain version which clang also uses.
Reorganize into common part, GNU part and clang part.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 1 file changed, 132 insertions(+), 51 deletions(-)

diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
index 8a1d0e88b..c936a3d7a 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -1,101 +1,182 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2018 ARM Corporation.
+    Copyright(c) 2020 ARM Corporation.
 
-Cross compile DPDK for ARM64
-============================
+Cross compiling 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.
+   like with x86), it is also possible to cross compile DPDK for ARM64.
+   An ARM64 cross compiler GNU toolchain or an LLVM/clang toolchain
+   may be used for cross-compilation.
 
-Obtain the cross tool chain
----------------------------
-The latest cross compile tool chain can be downloaded from:
+
+Prerequisites
+-------------
+
+NUMA 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.13 -b v2.0.13
+   ./autogen.sh
+   autoconf -i
+   ./configure --host=aarch64-linux-gnu CC=<compiler> --prefix=<numa install dir>
+   make install
+
+.. note::
+
+   The compiler above can be either aarch64-linux-gnu-gcc or clang.
+   See below for information on how to get the compiler of your choice.
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+Meson prerequisites
+~~~~~~~~~~~~~~~~~~~
+
+Meson depends on pkgconfig to find the dependencies.
+The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
+To install it in Ubuntu::
+
+   sudo apt install pkg-config-aarch64-linux-gnu
+
+
+GNU toolchain
+-------------
+
+.. _obtain_GNU_toolchain:
+
+Obtain the cross toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest GNU cross compiler toolchain can be downloaded from:
 https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads.
 
 It is always recommended to check and get the latest compiler tool from the page and use
-it to generate better code. As of this writing 8.3-2019.03 is the newest, the following
+it to generate better code. As of this writing 9.2-2019.12 is the newest, the following
 description is an example of this version.
 
 .. code-block:: console
 
-   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
+   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
 
 Unzip and add into the PATH
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. code-block:: console
 
-   tar -xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
-   export PATH=$PATH:<cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin
+   tar -xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
+   export PATH=$PATH:<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin
 
 .. note::
 
    For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/
 
-.. _arm_cross_build_getting_the_prerequisite_library:
+.. _augment_the_gnu_toolchain_with_numa_support:
 
-Getting the prerequisite library
---------------------------------
-
-NUMA is required by most modern machines, not needed for non-NUMA architectures.
+Augment the GNU toolchain with NUMA support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
-   otherwise the compilation will fail with errors.
+   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
 
 .. code-block:: console
 
-   git clone https://github.com/numactl/numactl.git
-   cd numactl
-   git checkout v2.0.13 -b v2.0.13
-   ./autogen.sh
-   autoconf -i
-   ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=<numa install dir>
-   make install
+   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/usr/include/
+   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
+   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
 
-The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+Cross Compiling DPDK with GNU toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+   meson cross-build --cross-file <target_machine_configuration>
+   ninja -C cross-build
+
+For example if the target machine is aarch64 we can use the following
+command::
 
-.. _augment_the_cross_toolchain_with_numa_support:
+   meson aarch64-build-gcc --cross-file config/arm/arm64_armv8_linux_gcc
+   ninja -C aarch64-build-gcc
 
-Augment the cross toolchain with NUMA support
----------------------------------------------
+
+LLVM/Clang toolchain
+--------------------
+
+Obtain the cross tool chain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest LLVM/Clang cross compiler toolchain can be downloaded from:
+https://developer.arm.com/tools-and-software/open-source-software/developer-tools/llvm-toolchain.
+
+.. code-block:: console
+
+   # Ubuntu binaries
+   wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+
+The LLVM/Clang toolchain does not implement the standard c library. The GNU toolchain
+ships an implementation we can use. Refer to obtain_GNU_toolchain_ to get the
+GNU toolchain.
+
+Unzip and add into the PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+   tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+   export PATH=$PATH:<cross_install_dir>/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin
+
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+   To use the NUMA library follow the same steps as for
+   augment_the_gnu_toolchain_with_numa_support_.
 
-Copy the NUMA header files and lib to the cross compiler's directories:
+The paths to GNU stdlib must be specified in a cross file. Augmenting the default
+cross-file's c_args and c_link_args config/arm/arm64_armv8_linux_clang_ubuntu1804 would look like this:
 
 .. code-block:: console
 
-   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include/
-   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
-   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
+   ...
+   c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
+   c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
 
-.. _configure_and_cross_compile_dpdk_build:
+Assuming the file with augmented c_args and c_link_args is named arm64_armv8_linux_clang,
+use the following command to cross-compile DPDK for your target machine::
 
-Cross Compiling DPDK
---------------------
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang
+   ninja -C aarch64-build-clang
 
-Meson depends on pkgconfig to find the dependencies.
-The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
-To install it in Ubuntu::
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson on Ubuntu 18.04
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   sudo apt-get install pkg-config-aarch64-linux-gnu
+On most popular Linux distribution it's not necessary to download
+the toolchains, but rather use the packages provided by said distributions.
+On Ubuntu 18.04, you'll need these packages:
 
-To cross-compile DPDK on a desired target machine we can use the following
-command::
+.. code-block:: console
 
-	meson cross-build --cross-file <target_machine_configuration>
-	ninja -C cross-build
+   sudo apt-get install pkg-config-aarch64-linux-gnu clang llvm llvm-dev lld
+   libc6-dev-arm64-cross libatomic1-arm64-cross libgcc-8-dev-arm64-cross
 
-For example if the target machine is arm64 we can use the following
-command::
+Use the following command to cross-compile DPDK for your target machine::
 
-	meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc
-	ninja -C arm64-build
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804
+   ninja -C aarch64-build-clang
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2020-10-04  8:29     ` Jerin Jacob
  2020-10-05 10:57       ` Juraj Linkeš
  0 siblings, 1 reply; 35+ messages in thread
From: Jerin Jacob @ 2020-10-04  8:29 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: Thomas Monjalon, David Marchand, Aaron Conole, Michael Santana, dpdk-dev

On Thu, Oct 1, 2020 at 4:07 PM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
> Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
> Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20 +++++++++++++++++++

IMO, if we are adding a specific OS distribution-specific
configuration then it won't scale.
Why not have just arm64_armv8_linux_clang ?

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

* Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-04  8:29     ` Jerin Jacob
@ 2020-10-05 10:57       ` Juraj Linkeš
  2020-10-05 14:26         ` Jerin Jacob
  0 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-05 10:57 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Thomas Monjalon, David Marchand, Aaron Conole, Michael Santana, dpdk-dev



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Sunday, October 4, 2020 10:30 AM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: Thomas Monjalon <thomas@monjalon.net>; David Marchand
> <david.marchand@redhat.com>; Aaron Conole <aconole@redhat.com>;
> Michael Santana <maicolgabriel@hotmail.com>; dpdk-dev <dev@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-
> compile
> 
> On Thu, Oct 1, 2020 at 4:07 PM Juraj Linkeš <juraj.linkes@pantheon.tech>
> wrote:
> >
> > Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
> > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > ---
> >  config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20
> > +++++++++++++++++++
> 
> IMO, if we are adding a specific OS distribution-specific configuration then it
> won't scale.
> Why not have just arm64_armv8_linux_clang ?

CFLAGS, LDFLAGS, c_args and c_link_args don't work when cross-compiling (at least they didn't work when I tested it) and that means we have to put the paths to stdlib (which llvm/clang doesn't implement) into a cross file. The arm64_armv8_linux_clang_ubuntu1804 contains paths that work with ubuntu clang/gcc packages (and would thus be used in CI). We can't have a generic cross file for clang because of this path limitation.

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

* Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-05 10:57       ` Juraj Linkeš
@ 2020-10-05 14:26         ` Jerin Jacob
  2020-10-22 13:40           ` Juraj Linkeš
  0 siblings, 1 reply; 35+ messages in thread
From: Jerin Jacob @ 2020-10-05 14:26 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: Thomas Monjalon, David Marchand, Aaron Conole, Michael Santana, dpdk-dev

On Mon, Oct 5, 2020 at 4:27 PM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Sunday, October 4, 2020 10:30 AM
> > To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Cc: Thomas Monjalon <thomas@monjalon.net>; David Marchand
> > <david.marchand@redhat.com>; Aaron Conole <aconole@redhat.com>;
> > Michael Santana <maicolgabriel@hotmail.com>; dpdk-dev <dev@dpdk.org>
> > Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-
> > compile
> >
> > On Thu, Oct 1, 2020 at 4:07 PM Juraj Linkeš <juraj.linkes@pantheon.tech>
> > wrote:
> > >
> > > Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
> > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > >
> > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > ---
> > >  config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20
> > > +++++++++++++++++++
> >
> > IMO, if we are adding a specific OS distribution-specific configuration then it
> > won't scale.
> > Why not have just arm64_armv8_linux_clang ?
>
> CFLAGS, LDFLAGS, c_args and c_link_args don't work when cross-compiling (at least they didn't work when I tested it) and that means we have to put the paths to stdlib (which llvm/clang doesn't implement) into a cross file

I am using cross-build, following syntax is working
CFLAGS='-g -ggdb3' meson build

> The arm64_armv8_linux_clang_ubuntu1804 contains paths that work with ubuntu clang/gcc packages (and would thus be used in CI). We can't have a generic cross file for clang because of this path limitation.

If ubuntu 18.04 needs some fix up like adding the stuff to PATH etc,
we could do a different stage in Travis ci. right?

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

* Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-05 14:26         ` Jerin Jacob
@ 2020-10-22 13:40           ` Juraj Linkeš
  0 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2020-10-22 13:40 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Thomas Monjalon, David Marchand, Aaron Conole, Michael Santana, dpdk-dev



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Monday, October 5, 2020 4:26 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: Thomas Monjalon <thomas@monjalon.net>; David Marchand
> <david.marchand@redhat.com>; Aaron Conole <aconole@redhat.com>;
> Michael Santana <maicolgabriel@hotmail.com>; dpdk-dev <dev@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-
> compile
> 
> On Mon, Oct 5, 2020 at 4:27 PM Juraj Linkeš <juraj.linkes@pantheon.tech>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Sunday, October 4, 2020 10:30 AM
> > > To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > Cc: Thomas Monjalon <thomas@monjalon.net>; David Marchand
> > > <david.marchand@redhat.com>; Aaron Conole <aconole@redhat.com>;
> > > Michael Santana <maicolgabriel@hotmail.com>; dpdk-dev <dev@dpdk.org>
> > > Subject: Re: [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to
> > > meson cross- compile
> > >
> > > On Thu, Oct 1, 2020 at 4:07 PM Juraj Linkeš
> > > <juraj.linkes@pantheon.tech>
> > > wrote:
> > > >
> > > > Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
> > > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > > >
> > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > > ---
> > > >  config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20
> > > > +++++++++++++++++++
> > >
> > > IMO, if we are adding a specific OS distribution-specific
> > > configuration then it won't scale.
> > > Why not have just arm64_armv8_linux_clang ?
> >
> > CFLAGS, LDFLAGS, c_args and c_link_args don't work when
> > cross-compiling (at least they didn't work when I tested it) and that
> > means we have to put the paths to stdlib (which llvm/clang doesn't
> > implement) into a cross file
> 
> I am using cross-build, following syntax is working CFLAGS='-g -ggdb3' meson
> build
> 
> > The arm64_armv8_linux_clang_ubuntu1804 contains paths that work with
> ubuntu clang/gcc packages (and would thus be used in CI). We can't have a
> generic cross file for clang because of this path limitation.
> 
> If ubuntu 18.04 needs some fix up like adding the stuff to PATH etc, we could do
> a different stage in Travis ci. right?

Sorry for the long delay, I was swamped with other stuff.

What do you mean by "following syntax is working CFLAGS='-g -ggdb3' meson build" in cross-builds? I tried the same thing with the flags I've put into the arm64_armv8_linux_clang_ubuntu1804 file and it doesn't work at all for cross builds - CFLAGS get only used for native compiler and not the cross compiler.

Here's what I mean:
CFLAGS='--sysroot /usr/aarch64-linux-gnu --gcc-toolchain=/usr' meson clang-build-aarch64 --werror -Dexamples=all --default-library static --cross-file config/arm/arm64_armv8_linux_clang  # the cross file doesn't contain the paths
Results in meson not being able to properly figure out size of "void *":
-----------------------
Running compile:
Working directory:  /tmp/tmpf_n3b9c7
Command line:  clang /tmp/tmpf_n3b9c7/testfile.c -pipe -D_FILE_OFFSET_BITS=64 -c -o /tmp/tmpf_n3b9c7/output.obj -target aarch64-linux-gnu -O0

Code:
 #include <stdio.h>

        int main(int argc, char **argv) {
            void * something;
        }
Compiler stdout:

Compiler stderr:
 In file included from /tmp/tmpf_n3b9c7/testfile.c:1:
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found
#include <bits/libc-header-start.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Checking for size of "void *": -1
-----------------------

However, when I put the paths into the cross file and run without CFLAGS, it works fine:
meson clang-build-aarch64 --werror -Dexamples=all --default-library static --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804  # the cross file contains the paths
Results in:
-----------------------
Running compile:
Working directory:  /tmp/tmpikoi3353
Command line:  clang /tmp/tmpikoi3353/testfile.c -pipe -D_FILE_OFFSET_BITS=64 -c -o /tmp/tmpikoi3353/output.obj -target aarch64-linux-gnu --sysroot /usr/aarch64-linux-gnu --gcc-toolchain=/usr -O0

Code:
 #include <stdio.h>

        int main(int argc, char **argv) {
            void * something;
        }
Compiler stdout:

Compiler stderr:
-----------------------

From what I was able to google, meson devs only want to allow specifying cross-specific option in cross files and are purposefully ignoring env variables for cross builds.

What we could do is just modify the cross file in Travis before running the build. But then we would have a useless clang cross file in the repo since we have to have the paths in it for clang cross compilition.

I hope I'm wrong, but I don't see a way around this.

What do you think?

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

* Re: [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2020-12-22  7:34       ` Ruifeng Wang
  0 siblings, 0 replies; 35+ messages in thread
From: Ruifeng Wang @ 2020-12-22  7:34 UTC (permalink / raw)
  To: Juraj Linkeš, thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, nd


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Juraj Linke?
> Sent: Friday, October 2, 2020 5:38 PM
> To: thomas@monjalon.net; david.marchand@redhat.com;
> aconole@redhat.com; maicolgabriel@hotmail.com
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build
> guide
> 
> Reorganize and update the aarch64 cross guide with clang cross compilation.
> Update the GNU toolchain version which clang also uses.
> Reorganize into common part, GNU part and clang part.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
>  1 file changed, 132 insertions(+), 51 deletions(-)
> 

Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>

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

* Re: [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2020-12-22  9:58       ` Ruifeng Wang
  0 siblings, 0 replies; 35+ messages in thread
From: Ruifeng Wang @ 2020-12-22  9:58 UTC (permalink / raw)
  To: Juraj Linkeš, thomas, david.marchand, aconole, maicolgabriel; +Cc: dev, nd


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Juraj Linke?
> Sent: Friday, October 2, 2020 5:38 PM
> To: thomas@monjalon.net; david.marchand@redhat.com;
> aconole@redhat.com; maicolgabriel@hotmail.com
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-
> compile
> 
> Create meson cross file arm64_armv8_linux_clang_ubuntu1804.
> Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20
> +++++++++++++++++++
>  1 file changed, 20 insertions(+)
>  create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804
> 
> diff --git a/config/arm/arm64_armv8_linux_clang_ubuntu1804
> b/config/arm/arm64_armv8_linux_clang_ubuntu1804
> new file mode 100644
> index 000000000..67f475eb0
> --- /dev/null
> +++ b/config/arm/arm64_armv8_linux_clang_ubuntu1804
> @@ -0,0 +1,20 @@
> +[binaries]
> +c = 'clang'
> +cpp = 'clang++'
> +ar = 'llvm-ar'
> +strip = 'llvm-strip'
> +llvm-config = 'llvm-config'
> +pcap-config = 'llvm-config'
> +pkgconfig = 'aarch64-linux-gnu-pkg-config'
> +
> +[host_machine]
> +system = 'linux'
> +cpu_family = 'aarch64'
> +cpu = 'armv8-a'
> +endian = 'little'
> +
> +[properties]
> +implementor_id = 'generic'
> +implementor_pn = 'default'
> +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot',
> +'/usr/aarch64-linux-gnu', '--gcc-toolchain=/usr'] c_link_args =
> +['-target', 'aarch64-linux-gnu', '-fuse-ld=lld']
> --
> 2.20.1

I understand specific flags are needed by clang to do cross compiling.
Path to gnu libc which is required could be different on some other systems.
The cross file works on Ubuntu, and could be referred to by other systems.

Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

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

* [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation
  2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
                       ` (2 preceding siblings ...)
  2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2021-01-19  8:33     ` Juraj Linkeš
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
                         ` (3 more replies)
  3 siblings, 4 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-19  8:33 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Use clang/LLVM toolchain with gcc stdlib to cross compile aarch64 target.

v3:
Removed AARCH_GCC and AARCH_CLANG variables in favor of CC_FOR_BUILD.

v4:
Rebased.
Updated commit msg in build: add aarch64 clang to meson cross-compile.

Juraj Linkeš (3):
  build: add aarch64 clang to meson cross-compile
  ci: add aarch64 clang cross-compilation builds
  doc: add clang to aarch64 cross build guide

 .ci/linux-build.sh                            |   6 +-
 .travis.yml                                   |  18 ++
 config/arm/arm64_armv8_linux_clang_ubuntu1804 |  20 ++
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 4 files changed, 175 insertions(+), 52 deletions(-)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

-- 
2.20.1


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

* [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
@ 2021-01-19  8:33       ` Juraj Linkeš
  2021-01-19 16:08         ` Thomas Monjalon
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-19  8:33 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.
Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.

The sysroot path must be in the cross-file so that Clang can find the
proper headers:
* setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't affect
cross builds (only native builds). Support added in 0.51.0.
* setting pkg-config vars only affects lib searching, not includes
* splitting the cross-file into two (one with clang info, one with
paths) doesn't work. Support added in 0.52.0.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

diff --git a/config/arm/arm64_armv8_linux_clang_ubuntu1804 b/config/arm/arm64_armv8_linux_clang_ubuntu1804
new file mode 100644
index 000000000..aa5ee0132
--- /dev/null
+++ b/config/arm/arm64_armv8_linux_clang_ubuntu1804
@@ -0,0 +1,20 @@
+[binaries]
+c = 'clang'
+cpp = 'clang++'
+ar = 'llvm-ar'
+strip = 'llvm-strip'
+llvm-config = 'llvm-config'
+pcap-config = 'llvm-config'
+pkgconfig = 'aarch64-linux-gnu-pkg-config'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'aarch64'
+cpu = 'armv8-a'
+endian = 'little'
+
+[properties]
+implementor_id = 'generic'
+implementor_pn = 'default'
+c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '/usr/aarch64-linux-gnu']
+c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']
-- 
2.20.1


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

* [dpdk-dev] [PATCH v4 2/3] ci: add aarch64 clang cross-compilation builds
  2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2021-01-19  8:33       ` Juraj Linkeš
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
  2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
  3 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-19  8:33 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Mirror the existing gcc jobs - build static and shared libs.
Use arm64_armv8_linux_clang_ubuntu1804 meson cross file.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .ci/linux-build.sh |  6 +++++-
 .travis.yml        | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d2c821adf..afa3689a0 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -32,7 +32,11 @@ install_libabigail() {
 
 if [ "$AARCH64" = "true" ]; then
     # convert the arch specifier
-    OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
+    if [ "$CC_FOR_BUILD" = "gcc" ]; then
+    	OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
+    elif [ "$CC_FOR_BUILD" = "clang" ]; then
+    	OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804"
+    fi
 fi
 
 if [ "$BUILD_DOCS" = "true" ]; then
diff --git a/.travis.yml b/.travis.yml
index 5aa7ad49f..ad6e956be 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,10 @@ _aarch64_packages: &aarch64_packages
   - *required_packages
   - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
 
+_aarch64_clang_packages: &aarch64_clang_packages
+  - *required_packages
+  - [libgcc-7-dev-arm64-cross, libatomic1-arm64-cross, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
+
 _libabigail_build_packages: &libabigail_build_packages
   - [autoconf, automake, libtool, pkg-config, libxml2-dev, libdw-dev]
 
@@ -102,6 +106,20 @@ jobs:
       apt:
         packages:
           - *aarch64_packages
+  - env: DEF_LIB="static" AARCH64=true
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
+  - env: DEF_LIB="shared" AARCH64=true
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
   # aarch64 gcc jobs
   - env: DEF_LIB="static"
     arch: arm64
-- 
2.20.1


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

* [dpdk-dev] [PATCH v4 3/3] doc: add clang to aarch64 cross build guide
  2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
@ 2021-01-19  8:33       ` Juraj Linkeš
  2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
  3 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-19  8:33 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Reorganize and update the aarch64 cross guide with clang cross
compilation. Update the GNU toolchain version which clang also uses.
Reorganize into common part, GNU part and clang part.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 1 file changed, 132 insertions(+), 51 deletions(-)

diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
index 8a1d0e88b..1fb1d6d49 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -1,101 +1,182 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2018 ARM Corporation.
+    Copyright(c) 2020 ARM Corporation.
 
-Cross compile DPDK for ARM64
-============================
+Cross compiling 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.
+   like with x86), it is also possible to cross compile DPDK for ARM64.
+   An ARM64 cross compiler GNU toolchain or an LLVM/clang toolchain
+   may be used for cross-compilation.
 
-Obtain the cross tool chain
----------------------------
-The latest cross compile tool chain can be downloaded from:
+
+Prerequisites
+-------------
+
+NUMA 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.13 -b v2.0.13
+   ./autogen.sh
+   autoconf -i
+   ./configure --host=aarch64-linux-gnu CC=<compiler> --prefix=<numa install dir>
+   make install
+
+.. note::
+
+   The compiler above can be either aarch64-linux-gnu-gcc or clang.
+   See below for information on how to get the compiler of your choice.
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+Meson prerequisites
+~~~~~~~~~~~~~~~~~~~
+
+Meson depends on pkgconfig to find the dependencies.
+The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
+To install it in Ubuntu::
+
+   sudo apt install pkg-config-aarch64-linux-gnu
+
+
+GNU toolchain
+-------------
+
+.. _obtain_GNU_toolchain:
+
+Obtain the cross toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest GNU cross compiler toolchain can be downloaded from:
 https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads.
 
 It is always recommended to check and get the latest compiler tool from the page and use
-it to generate better code. As of this writing 8.3-2019.03 is the newest, the following
+it to generate better code. As of this writing 9.2-2019.12 is the newest, the following
 description is an example of this version.
 
 .. code-block:: console
 
-   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
+   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
 
 Unzip and add into the PATH
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. code-block:: console
 
-   tar -xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
-   export PATH=$PATH:<cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin
+   tar -xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
+   export PATH=$PATH:<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin
 
 .. note::
 
    For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/
 
-.. _arm_cross_build_getting_the_prerequisite_library:
+.. _augment_the_gnu_toolchain_with_numa_support:
 
-Getting the prerequisite library
---------------------------------
-
-NUMA is required by most modern machines, not needed for non-NUMA architectures.
+Augment the GNU toolchain with NUMA support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
-   otherwise the compilation will fail with errors.
+   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
 
 .. code-block:: console
 
-   git clone https://github.com/numactl/numactl.git
-   cd numactl
-   git checkout v2.0.13 -b v2.0.13
-   ./autogen.sh
-   autoconf -i
-   ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=<numa install dir>
-   make install
+   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/usr/include/
+   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
+   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
 
-The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+Cross Compiling DPDK with GNU toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+   meson cross-build --cross-file <target_machine_configuration>
+   ninja -C cross-build
+
+For example if the target machine is aarch64 we can use the following
+command::
 
-.. _augment_the_cross_toolchain_with_numa_support:
+   meson aarch64-build-gcc --cross-file config/arm/arm64_armv8_linux_gcc
+   ninja -C aarch64-build-gcc
 
-Augment the cross toolchain with NUMA support
----------------------------------------------
+
+LLVM/Clang toolchain
+--------------------
+
+Obtain the cross tool chain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest LLVM/Clang cross compiler toolchain can be downloaded from:
+https://developer.arm.com/tools-and-software/open-source-software/developer-tools/llvm-toolchain.
+
+.. code-block:: console
+
+   # Ubuntu binaries
+   wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+
+The LLVM/Clang toolchain does not implement the standard c library. The GNU toolchain
+ships an implementation we can use. Refer to obtain_GNU_toolchain_ to get the
+GNU toolchain.
+
+Unzip and add into the PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+   tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+   export PATH=$PATH:<cross_install_dir>/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin
+
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+   To use the NUMA library follow the same steps as for
+   augment_the_gnu_toolchain_with_numa_support_.
 
-Copy the NUMA header files and lib to the cross compiler's directories:
+The paths to GNU stdlib must be specified in a cross file. Augmenting the default
+cross-file's c_args and c_link_args config/arm/arm64_armv8_linux_clang_ubuntu1804 would look like this:
 
 .. code-block:: console
 
-   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include/
-   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
-   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
+   ...
+   c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc']
+   c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
 
-.. _configure_and_cross_compile_dpdk_build:
+Assuming the file with augmented c_args and c_link_args is named arm64_armv8_linux_clang,
+use the following command to cross-compile DPDK for your target machine::
 
-Cross Compiling DPDK
---------------------
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang
+   ninja -C aarch64-build-clang
 
-Meson depends on pkgconfig to find the dependencies.
-The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
-To install it in Ubuntu::
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson on Ubuntu 18.04
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   sudo apt-get install pkg-config-aarch64-linux-gnu
+On most popular Linux distribution it's not necessary to download
+the toolchains, but rather use the packages provided by said distributions.
+On Ubuntu 18.04, you'll need these packages:
 
-To cross-compile DPDK on a desired target machine we can use the following
-command::
+.. code-block:: console
 
-	meson cross-build --cross-file <target_machine_configuration>
-	ninja -C cross-build
+   sudo apt-get install pkg-config-aarch64-linux-gnu clang llvm llvm-dev lld
+   libc6-dev-arm64-cross libatomic1-arm64-cross libgcc-8-dev-arm64-cross
 
-For example if the target machine is arm64 we can use the following
-command::
+Use the following command to cross-compile DPDK for your target machine::
 
-	meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc
-	ninja -C arm64-build
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804
+   ninja -C aarch64-build-clang
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2021-01-19 16:08         ` Thomas Monjalon
  2021-01-20  8:24           ` Juraj Linkeš
  0 siblings, 1 reply; 35+ messages in thread
From: Thomas Monjalon @ 2021-01-19 16:08 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev, bruce.richardson

19/01/2021 09:33, Juraj Linkeš:
> Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.

Why is it specific to Ubuntu 18.04?
I don't want to add specifc cross files per distributions.

> Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> 
> The sysroot path must be in the cross-file so that Clang can find the
> proper headers:
> * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't affect
> cross builds (only native builds). Support added in 0.51.0.
> * setting pkg-config vars only affects lib searching, not includes
> * splitting the cross-file into two (one with clang info, one with
> paths) doesn't work. Support added in 0.52.0.

I don't understand the explanations above.
Please explain what is the bug and how it is fixed.

[...]
> +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '/usr/aarch64-linux-gnu']
> +c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']




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

* Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-19 16:08         ` Thomas Monjalon
@ 2021-01-20  8:24           ` Juraj Linkeš
  2021-01-20 10:21             ` Thomas Monjalon
  0 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-20  8:24 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev, bruce.richardson



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, January 19, 2021 5:08 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: david.marchand@redhat.com; aconole@redhat.com;
> maicolgabriel@hotmail.com; jerinjacobk@gmail.com; ferruh.yigit@intel.com;
> Ruifeng.Wang@arm.com; dev@dpdk.org; bruce.richardson@intel.com
> Subject: Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-
> compile
> 
> 19/01/2021 09:33, Juraj Linkeš:
> > Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.
> 
> Why is it specific to Ubuntu 18.04?
> I don't want to add specifc cross files per distributions.
> 
> > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> >
> > The sysroot path must be in the cross-file so that Clang can find the
> > proper headers:
> > * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't affect
> > cross builds (only native builds). Support added in 0.51.0.
> > * setting pkg-config vars only affects lib searching, not includes
> > * splitting the cross-file into two (one with clang info, one with
> > paths) doesn't work. Support added in 0.52.0.
> 
> I don't understand the explanations above.
> Please explain what is the bug and how it is fixed.
> 

I guess the missing piece is that the sysroot path is the ubuntu specific part. The explanations illustrate why we can't have a generic cross file with the current meson version - there's no way to pass the paths to cross builds. Now that I think about it, the commit message needs a rewrite - I should've mentioned that clang/llvm doesn't provide it's own standard c lib, so that has to come from elsewhere (such as gcc) and thus we have to provide the paths.

> [...]
> > +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot',
> > +'/usr/aarch64-linux-gnu'] c_link_args = ['-target',
> > +'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']
> 
> 
> 


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

* Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-20  8:24           ` Juraj Linkeš
@ 2021-01-20 10:21             ` Thomas Monjalon
  2021-01-20 10:30               ` Juraj Linkeš
  0 siblings, 1 reply; 35+ messages in thread
From: Thomas Monjalon @ 2021-01-20 10:21 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev, bruce.richardson

20/01/2021 09:24, Juraj Linkeš:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 19/01/2021 09:33, Juraj Linkeš:
> > > Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.
> > 
> > Why is it specific to Ubuntu 18.04?
> > I don't want to add specifc cross files per distributions.
> > 
> > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > >
> > > The sysroot path must be in the cross-file so that Clang can find the
> > > proper headers:
> > > * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't affect
> > > cross builds (only native builds). Support added in 0.51.0.
> > > * setting pkg-config vars only affects lib searching, not includes
> > > * splitting the cross-file into two (one with clang info, one with
> > > paths) doesn't work. Support added in 0.52.0.
> > 
> > I don't understand the explanations above.
> > Please explain what is the bug and how it is fixed.
> > 
> 
> I guess the missing piece is that the sysroot path is the ubuntu specific part. The explanations illustrate why we can't have a generic cross file with the current meson version - there's no way to pass the paths to cross builds. Now that I think about it, the commit message needs a rewrite - I should've mentioned that clang/llvm doesn't provide it's own standard c lib, so that has to come from elsewhere (such as gcc) and thus we have to provide the paths.

Can it be done with the option -Dc_args?


> > [...]
> > > +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot',
> > > +'/usr/aarch64-linux-gnu'] c_link_args = ['-target',
> > > +'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']




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

* Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-20 10:21             ` Thomas Monjalon
@ 2021-01-20 10:30               ` Juraj Linkeš
  2021-01-20 10:34                 ` Thomas Monjalon
  0 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-20 10:30 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev, bruce.richardson



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, January 20, 2021 11:22 AM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: david.marchand@redhat.com; aconole@redhat.com;
> maicolgabriel@hotmail.com; jerinjacobk@gmail.com; ferruh.yigit@intel.com;
> Ruifeng.Wang@arm.com; dev@dpdk.org; bruce.richardson@intel.com
> Subject: Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-
> compile
> 
> 20/01/2021 09:24, Juraj Linkeš:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 19/01/2021 09:33, Juraj Linkeš:
> > > > Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.
> > >
> > > Why is it specific to Ubuntu 18.04?
> > > I don't want to add specifc cross files per distributions.
> > >
> > > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > > >
> > > > The sysroot path must be in the cross-file so that Clang can find
> > > > the proper headers:
> > > > * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't
> > > > affect cross builds (only native builds). Support added in 0.51.0.
> > > > * setting pkg-config vars only affects lib searching, not includes
> > > > * splitting the cross-file into two (one with clang info, one with
> > > > paths) doesn't work. Support added in 0.52.0.
> > >
> > > I don't understand the explanations above.
> > > Please explain what is the bug and how it is fixed.
> > >
> >
> > I guess the missing piece is that the sysroot path is the ubuntu specific part.
> The explanations illustrate why we can't have a generic cross file with the
> current meson version - there's no way to pass the paths to cross builds. Now
> that I think about it, the commit message needs a rewrite - I should've
> mentioned that clang/llvm doesn't provide it's own standard c lib, so that has to
> come from elsewhere (such as gcc) and thus we have to provide the paths.
> 
> Can it be done with the option -Dc_args?
> 

Not in Meson 0.47.1, it's explained in the commit msg:
* setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't 
affect cross builds (only native builds). Support added in 0.51.0.

> 
> > > [...]
> > > > +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot',
> > > > +'/usr/aarch64-linux-gnu'] c_link_args = ['-target',
> > > > +'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']
> 
> 
> 


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

* Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-20 10:30               ` Juraj Linkeš
@ 2021-01-20 10:34                 ` Thomas Monjalon
  2021-01-21 15:02                   ` Juraj Linkeš
  0 siblings, 1 reply; 35+ messages in thread
From: Thomas Monjalon @ 2021-01-20 10:34 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev, bruce.richardson

20/01/2021 11:30, Juraj Linkeš:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 20/01/2021 09:24, Juraj Linkeš:
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > 19/01/2021 09:33, Juraj Linkeš:
> > > > > Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.
> > > >
> > > > Why is it specific to Ubuntu 18.04?
> > > > I don't want to add specifc cross files per distributions.
> > > >
> > > > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > > > >
> > > > > The sysroot path must be in the cross-file so that Clang can find
> > > > > the proper headers:
> > > > > * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't
> > > > > affect cross builds (only native builds). Support added in 0.51.0.
> > > > > * setting pkg-config vars only affects lib searching, not includes
> > > > > * splitting the cross-file into two (one with clang info, one with
> > > > > paths) doesn't work. Support added in 0.52.0.
> > > >
> > > > I don't understand the explanations above.
> > > > Please explain what is the bug and how it is fixed.
> > > >
> > >
> > > I guess the missing piece is that the sysroot path is the ubuntu specific part.
> > The explanations illustrate why we can't have a generic cross file with the
> > current meson version - there's no way to pass the paths to cross builds. Now
> > that I think about it, the commit message needs a rewrite - I should've
> > mentioned that clang/llvm doesn't provide it's own standard c lib, so that has to
> > come from elsewhere (such as gcc) and thus we have to provide the paths.
> > 
> > Can it be done with the option -Dc_args?
> > 
> 
> Not in Meson 0.47.1, it's explained in the commit msg:
> * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't 
> affect cross builds (only native builds). Support added in 0.51.0.

So I suggest to make it clearer :)
One proposal:

* setting CFLAGS/LDFLAGS variables or using -Dc_args/-Dc_link_args options
  do not work on cross builds until Meson 0.51.0.

> > > > [...]
> > > > > +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot',
> > > > > +'/usr/aarch64-linux-gnu'] c_link_args = ['-target',
> > > > > +'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']
> > 
> > 
> > 
> 
> 






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

* Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-20 10:34                 ` Thomas Monjalon
@ 2021-01-21 15:02                   ` Juraj Linkeš
  0 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-21 15:02 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev, bruce.richardson



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, January 20, 2021 11:35 AM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: david.marchand@redhat.com; aconole@redhat.com;
> maicolgabriel@hotmail.com; jerinjacobk@gmail.com; ferruh.yigit@intel.com;
> Ruifeng.Wang@arm.com; dev@dpdk.org; bruce.richardson@intel.com
> Subject: Re: [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-
> compile
> 
> 20/01/2021 11:30, Juraj Linkeš:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 20/01/2021 09:24, Juraj Linkeš:
> > > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > > 19/01/2021 09:33, Juraj Linkeš:
> > > > > > Create meson cross-file arm64_armv8_linux_clang_ubuntu1804.
> > > > >
> > > > > Why is it specific to Ubuntu 18.04?
> > > > > I don't want to add specifc cross files per distributions.
> > > > >
> > > > > > Use clang/LLVM toolchain with sysroot pointing to gcc cross stdlib.
> > > > > >
> > > > > > The sysroot path must be in the cross-file so that Clang can
> > > > > > find the proper headers:
> > > > > > * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't
> > > > > > affect cross builds (only native builds). Support added in 0.51.0.
> > > > > > * setting pkg-config vars only affects lib searching, not
> > > > > > includes
> > > > > > * splitting the cross-file into two (one with clang info, one
> > > > > > with
> > > > > > paths) doesn't work. Support added in 0.52.0.
> > > > >
> > > > > I don't understand the explanations above.
> > > > > Please explain what is the bug and how it is fixed.
> > > > >
> > > >
> > > > I guess the missing piece is that the sysroot path is the ubuntu specific part.
> > > The explanations illustrate why we can't have a generic cross file
> > > with the current meson version - there's no way to pass the paths to
> > > cross builds. Now that I think about it, the commit message needs a
> > > rewrite - I should've mentioned that clang/llvm doesn't provide it's
> > > own standard c lib, so that has to come from elsewhere (such as gcc) and
> thus we have to provide the paths.
> > >
> > > Can it be done with the option -Dc_args?
> > >
> >
> > Not in Meson 0.47.1, it's explained in the commit msg:
> > * setting CFLAGS, LDFLAGS or -Dc_args, -Dc_link_args doesn't affect
> > cross builds (only native builds). Support added in 0.51.0.
> 
> So I suggest to make it clearer :)
> One proposal:
> 
> * setting CFLAGS/LDFLAGS variables or using -Dc_args/-Dc_link_args options
>   do not work on cross builds until Meson 0.51.0.
> 

Ok, I'll reword the commit message to make it more clearer based on your feedback.

> > > > > [...]
> > > > > > +c_args = ['-target', 'aarch64-linux-gnu', '--sysroot',
> > > > > > +'/usr/aarch64-linux-gnu'] c_link_args = ['-target',
> > > > > > +'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']
> > >
> > >
> > >
> >
> >
> 
> 
> 
> 
> 


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

* [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation
  2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
                         ` (2 preceding siblings ...)
  2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2021-01-21 15:51       ` Juraj Linkeš
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
                           ` (3 more replies)
  3 siblings, 4 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-21 15:51 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Use clang/LLVM toolchain with gcc stdlib to cross compile aarch64 target.

v3:
Removed AARCH_GCC and AARCH_CLANG variables in favor of CC_FOR_BUILD.

v4:
Rebased.
Updated commit msg in build: add aarch64 clang to meson cross-compile.

v5:
Rebased.
Reworded commit msg in build: add aarch64 clang to meson cross-compile.

Juraj Linkeš (3):
  build: add aarch64 clang to meson cross-compile
  ci: add aarch64 clang cross-compilation builds
  doc: add clang to aarch64 cross build guide

 .ci/linux-build.sh                            |   6 +-
 .travis.yml                                   |  18 ++
 config/arm/arm64_armv8_linux_clang_ubuntu1804 |  20 ++
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 4 files changed, 175 insertions(+), 52 deletions(-)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

-- 
2.20.1


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

* [dpdk-dev] [PATCH v5 1/3] build: add aarch64 clang to meson cross-compile
  2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
@ 2021-01-21 15:51         ` Juraj Linkeš
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-21 15:51 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Create distribution specific meson cross-file
arm64_armv8_linux_clang_ubuntu1804. The file is distribution specific
because it contains paths to headers and libs specific to the
distribution. The clang/LLVM toolchain does not provide its own c stdlib
so the paths must be supplied in some manner.

In the current version of meson, v0.47.1, the only place
where the paths can be specified is the cross-file. Other possibilities
do not work:
* setting CFLAGS, LDFLAGS only sets these for non-cross builds.
* setting -Dc_args, -Dc_link_args on the command line also only sets
these for non-cross builds. Support for specifying these for
cross builds was added in v0.51.0 [0].
* the cross-file can't be split into generic clang cross config and
distribution specific config. Support added in v0.52.0 [1].

[0] https://mesonbuild.com/Builtin-options.html#specifying-options-per-machine
[1] https://mesonbuild.com/Machine-files.html#loading-multiple-machine-files

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 config/arm/arm64_armv8_linux_clang_ubuntu1804 | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 config/arm/arm64_armv8_linux_clang_ubuntu1804

diff --git a/config/arm/arm64_armv8_linux_clang_ubuntu1804 b/config/arm/arm64_armv8_linux_clang_ubuntu1804
new file mode 100644
index 000000000..aa5ee0132
--- /dev/null
+++ b/config/arm/arm64_armv8_linux_clang_ubuntu1804
@@ -0,0 +1,20 @@
+[binaries]
+c = 'clang'
+cpp = 'clang++'
+ar = 'llvm-ar'
+strip = 'llvm-strip'
+llvm-config = 'llvm-config'
+pcap-config = 'llvm-config'
+pkgconfig = 'aarch64-linux-gnu-pkg-config'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'aarch64'
+cpu = 'armv8-a'
+endian = 'little'
+
+[properties]
+implementor_id = 'generic'
+implementor_pn = 'default'
+c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '/usr/aarch64-linux-gnu']
+c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '--gcc-toolchain=/usr']
-- 
2.20.1


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

* [dpdk-dev] [PATCH v5 2/3] ci: add aarch64 clang cross-compilation builds
  2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
@ 2021-01-21 15:51         ` Juraj Linkeš
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
  2021-01-26 11:45         ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Thomas Monjalon
  3 siblings, 0 replies; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-21 15:51 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Mirror the existing gcc jobs - build static and shared libs.
Use arm64_armv8_linux_clang_ubuntu1804 meson cross file.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 .ci/linux-build.sh |  6 +++++-
 .travis.yml        | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d2c821adf..afa3689a0 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -32,7 +32,11 @@ install_libabigail() {
 
 if [ "$AARCH64" = "true" ]; then
     # convert the arch specifier
-    OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
+    if [ "$CC_FOR_BUILD" = "gcc" ]; then
+    	OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
+    elif [ "$CC_FOR_BUILD" = "clang" ]; then
+    	OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804"
+    fi
 fi
 
 if [ "$BUILD_DOCS" = "true" ]; then
diff --git a/.travis.yml b/.travis.yml
index 5aa7ad49f..ad6e956be 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,10 @@ _aarch64_packages: &aarch64_packages
   - *required_packages
   - [gcc-aarch64-linux-gnu, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
 
+_aarch64_clang_packages: &aarch64_clang_packages
+  - *required_packages
+  - [libgcc-7-dev-arm64-cross, libatomic1-arm64-cross, libc6-dev-arm64-cross, pkg-config-aarch64-linux-gnu]
+
 _libabigail_build_packages: &libabigail_build_packages
   - [autoconf, automake, libtool, pkg-config, libxml2-dev, libdw-dev]
 
@@ -102,6 +106,20 @@ jobs:
       apt:
         packages:
           - *aarch64_packages
+  - env: DEF_LIB="static" AARCH64=true
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
+  - env: DEF_LIB="shared" AARCH64=true
+    arch: amd64
+    compiler: clang
+    addons:
+      apt:
+        packages:
+          - *aarch64_clang_packages
   # aarch64 gcc jobs
   - env: DEF_LIB="static"
     arch: arm64
-- 
2.20.1


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

* [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide
  2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
@ 2021-01-21 15:51         ` Juraj Linkeš
  2021-01-26 10:24           ` Thomas Monjalon
  2021-01-26 11:45         ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Thomas Monjalon
  3 siblings, 1 reply; 35+ messages in thread
From: Juraj Linkeš @ 2021-01-21 15:51 UTC (permalink / raw)
  To: thomas, david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang
  Cc: dev, Juraj Linkeš

Reorganize and update the aarch64 cross guide with clang cross
compilation. Update the GNU toolchain version which clang also uses.
Reorganize into common part, GNU part and clang part.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 183 +++++++++++++-----
 1 file changed, 132 insertions(+), 51 deletions(-)

diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
index d0d346c83..ed34cdb0f 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -1,104 +1,185 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2018 ARM Corporation.
+    Copyright(c) 2020 ARM Corporation.
 
-Cross compile DPDK for ARM64
-============================
+Cross compiling 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.
+   like with x86), it is also possible to cross compile DPDK for ARM64.
+   An ARM64 cross compiler GNU toolchain or an LLVM/clang toolchain
+   may be used for cross-compilation.
 
-Obtain the cross tool chain
----------------------------
-The latest cross compile tool chain can be downloaded from:
+
+Prerequisites
+-------------
+
+NUMA 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.13 -b v2.0.13
+   ./autogen.sh
+   autoconf -i
+   ./configure --host=aarch64-linux-gnu CC=<compiler> --prefix=<numa install dir>
+   make install
+
+.. note::
+
+   The compiler above can be either aarch64-linux-gnu-gcc or clang.
+   See below for information on how to get the compiler of your choice.
+
+The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+
+Meson prerequisites
+~~~~~~~~~~~~~~~~~~~
+
+Meson depends on pkgconfig to find the dependencies.
+The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
+To install it in Ubuntu::
+
+   sudo apt install pkg-config-aarch64-linux-gnu
+
+
+GNU toolchain
+-------------
+
+.. _obtain_GNU_toolchain:
+
+Obtain the cross toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest GNU cross compiler toolchain can be downloaded from:
 https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads.
 
 It is always recommended to check and get the latest compiler tool from the page and use
-it to generate better code. As of this writing 8.3-2019.03 is the newest, the following
+it to generate better code. As of this writing 9.2-2019.12 is the newest, the following
 description is an example of this version.
 
 .. code-block:: console
 
-   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
+   wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
 
 Unzip and add into the PATH
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. code-block:: console
 
-   tar -xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
-   export PATH=$PATH:<cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin
+   tar -xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
+   export PATH=$PATH:<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin
 
 .. note::
 
    For the host requirements and other info, refer to the release note section: https://releases.linaro.org/components/toolchain/binaries/
 
-.. _arm_cross_build_getting_the_prerequisite_library:
+.. _augment_the_gnu_toolchain_with_numa_support:
 
-Getting the prerequisite library
---------------------------------
-
-NUMA is required by most modern machines, not needed for non-NUMA architectures.
+Augment the GNU toolchain with NUMA support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   For compiling the NUMA lib, run libtool --version to ensure the libtool version >= 2.2,
-   otherwise the compilation will fail with errors.
+   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+
+Copy the NUMA header files and lib to the cross compiler's directories:
 
 .. code-block:: console
 
-   git clone https://github.com/numactl/numactl.git
-   cd numactl
-   git checkout v2.0.13 -b v2.0.13
-   ./autogen.sh
-   autoconf -i
-   ./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=<numa install dir>
-   make install
+   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/usr/include/
+   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
+   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/9.2.1/
 
-The numa header files and lib file is generated in the include and lib folder respectively under <numa install dir>.
+Cross Compiling DPDK with GNU toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To cross-compile DPDK on a desired target machine we can use the following
+command::
+
+   meson cross-build --cross-file <target_machine_configuration>
+   ninja -C cross-build
+
+For example if the target machine is aarch64 we can use the following
+command::
 
-.. _augment_the_cross_toolchain_with_numa_support:
+   meson aarch64-build-gcc --cross-file config/arm/arm64_armv8_linux_gcc
+   ninja -C aarch64-build-gcc
 
-Augment the cross toolchain with NUMA support
----------------------------------------------
+
+LLVM/Clang toolchain
+--------------------
+
+Obtain the cross tool chain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The latest LLVM/Clang cross compiler toolchain can be downloaded from:
+https://developer.arm.com/tools-and-software/open-source-software/developer-tools/llvm-toolchain.
+
+.. code-block:: console
+
+   # Ubuntu binaries
+   wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+
+The LLVM/Clang toolchain does not implement the standard c library. The GNU toolchain
+ships an implementation we can use. Refer to obtain_GNU_toolchain_ to get the
+GNU toolchain.
+
+Unzip and add into the PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: console
+
+   tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
+   export PATH=$PATH:<cross_install_dir>/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin
+
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. note::
 
-   This way is optional, an alternative is to use extra CFLAGS and LDFLAGS.
+   To use the NUMA library follow the same steps as for
+   augment_the_gnu_toolchain_with_numa_support_.
 
-Copy the NUMA header files and lib to the cross compiler's directories:
+The paths to GNU stdlib must be specified in a cross file. Augmenting the default
+cross-file's c_args and c_link_args config/arm/arm64_armv8_linux_clang_ubuntu1804 would look like this:
 
 .. code-block:: console
 
-   cp <numa_install_dir>/include/numa*.h <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include/
-   cp <numa_install_dir>/lib/libnuma.a <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
-   cp <numa_install_dir>/lib/libnuma.so <cross_install_dir>/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/8.3.0/
+   ...
+   c_args = ['-target', 'aarch64-linux-gnu', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc']
+   c_link_args = ['-target', 'aarch64-linux-gnu', '-fuse-ld=lld', '--sysroot', '<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc', '--gcc-toolchain=<cross_install_dir>/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu']
 
-.. _configure_and_cross_compile_dpdk_build:
+Assuming the file with augmented c_args and c_link_args is named arm64_armv8_linux_clang,
+use the following command to cross-compile DPDK for your target machine::
 
-Cross Compiling DPDK
---------------------
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang
+   ninja -C aarch64-build-clang
 
-Meson depends on pkgconfig to find the dependencies.
-The package ``pkg-config-aarch64-linux-gnu`` is required for aarch64.
-To install it in Ubuntu::
+Cross Compiling DPDK with LLVM/Clang toolchain using Meson on Ubuntu 18.04
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   sudo apt-get install pkg-config-aarch64-linux-gnu
+On most popular Linux distribution it's not necessary to download
+the toolchains, but rather use the packages provided by said distributions.
+On Ubuntu 18.04, you'll need these packages:
 
-To cross-compile DPDK on a desired target machine we can use the following
-command::
+.. code-block:: console
 
-	meson cross-build --cross-file <target_machine_configuration>
-	ninja -C cross-build
+   sudo apt-get install pkg-config-aarch64-linux-gnu clang llvm llvm-dev lld
+   libc6-dev-arm64-cross libatomic1-arm64-cross libgcc-8-dev-arm64-cross
 
-For example if the target machine is arm64 we can use the following
-command::
+Use the following command to cross-compile DPDK for your target machine::
 
-	meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc
-	ninja -C arm64-build
+   meson aarch64-build-clang --cross-file config/arm/arm64_armv8_linux_clang_ubuntu1804
+   ninja -C aarch64-build-clang
 
 Supported cross-compilation targets
 -----------------------------------
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2021-01-26 10:24           ` Thomas Monjalon
  0 siblings, 0 replies; 35+ messages in thread
From: Thomas Monjalon @ 2021-01-26 10:24 UTC (permalink / raw)
  To: Ruifeng.Wang, Juraj Linkeš
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk, ferruh.yigit, dev

21/01/2021 16:51, Juraj Linkeš:
> Reorganize and update the aarch64 cross guide with clang cross
> compilation. Update the GNU toolchain version which clang also uses.
> Reorganize into common part, GNU part and clang part.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>

I fix some spacing, quoting and avoid "you" form, while applying.





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

* Re: [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation
  2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
                           ` (2 preceding siblings ...)
  2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
@ 2021-01-26 11:45         ` Thomas Monjalon
  3 siblings, 0 replies; 35+ messages in thread
From: Thomas Monjalon @ 2021-01-26 11:45 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: david.marchand, aconole, maicolgabriel, jerinjacobk,
	ferruh.yigit, Ruifeng.Wang, dev

> Juraj Linkeš (3):
>   build: add aarch64 clang to meson cross-compile
>   ci: add aarch64 clang cross-compilation builds
>   doc: add clang to aarch64 cross build guide

Applied with doc fixups, thanks




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

end of thread, other threads:[~2021-01-26 11:45 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 10:20 [dpdk-dev] [PATCH 0/2] aarch64 clang cross compilation Juraj Linkeš
2020-10-01 10:20 ` [dpdk-dev] [PATCH 1/2] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2020-10-01 10:20 ` [dpdk-dev] [PATCH 2/2] doc: add clang to aarch64 cross build guide Juraj Linkeš
2020-10-01 10:30 ` [dpdk-dev] [PATCH v2 0/3] aarch64 clang cross compilation Juraj Linkeš
2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2020-10-04  8:29     ` Jerin Jacob
2020-10-05 10:57       ` Juraj Linkeš
2020-10-05 14:26         ` Jerin Jacob
2020-10-22 13:40           ` Juraj Linkeš
2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2020-10-01 13:31     ` Aaron Conole
2020-10-01 14:43       ` Juraj Linkeš
2020-10-01 10:30   ` [dpdk-dev] [PATCH v2 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2020-10-02  9:38   ` [dpdk-dev] [PATCH v3 0/3] aarch64 clang cross compilation Juraj Linkeš
2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2020-12-22  9:58       ` Ruifeng Wang
2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2020-10-02  9:38     ` [dpdk-dev] [PATCH v3 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2020-12-22  7:34       ` Ruifeng Wang
2021-01-19  8:33     ` [dpdk-dev] [PATCH v4 0/3] aarch64 clang cross compilation Juraj Linkeš
2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2021-01-19 16:08         ` Thomas Monjalon
2021-01-20  8:24           ` Juraj Linkeš
2021-01-20 10:21             ` Thomas Monjalon
2021-01-20 10:30               ` Juraj Linkeš
2021-01-20 10:34                 ` Thomas Monjalon
2021-01-21 15:02                   ` Juraj Linkeš
2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2021-01-19  8:33       ` [dpdk-dev] [PATCH v4 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2021-01-21 15:51       ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Juraj Linkeš
2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 1/3] build: add aarch64 clang to meson cross-compile Juraj Linkeš
2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 2/3] ci: add aarch64 clang cross-compilation builds Juraj Linkeš
2021-01-21 15:51         ` [dpdk-dev] [PATCH v5 3/3] doc: add clang to aarch64 cross build guide Juraj Linkeš
2021-01-26 10:24           ` Thomas Monjalon
2021-01-26 11:45         ` [dpdk-dev] [PATCH v5 0/3] aarch64 clang cross compilation Thomas Monjalon

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).