[v2,1/4] doc: arm64 cross build CFLAGS/LDFLAGS alternatives

Message ID 1638875109-5544-2-git-send-email-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series arm64 cross docs improvements/fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Juraj Linkeš Dec. 7, 2021, 11:05 a.m. UTC
  Remove CFLAGS and LDFLAGS since Meson doesn't support them well enough.
Add Meson alternatives: -Dc_args and -Dc_link_args on the command line
and in cross files.

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

Comments

Ruifeng Wang Dec. 15, 2021, 8 a.m. UTC | #1
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: Tuesday, December 7, 2021 7:05 PM
> To: thomas@monjalon.net; david.marchand@redhat.com; Honnappa
> Nagarahalli <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; ferruh.yigit@intel.com; jerinjacobk@gmail.com
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v2 1/4] doc: arm64 cross build CFLAGS/LDFLAGS alternatives
> 
> Remove CFLAGS and LDFLAGS since Meson doesn't support them well
> enough.
> Add Meson alternatives: -Dc_args and -Dc_link_args on the command line
> and in cross files.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  .../linux_gsg/cross_build_dpdk_for_arm64.rst  | 25 ++++++++++++++++---
>  1 file changed, 21 insertions(+), 4 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 d59af58235..51075bd4a9 100644
> --- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> @@ -98,10 +98,6 @@ For aarch32::
>  Augment the GNU toolchain with NUMA support
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> -.. note::
> -
> -   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
> @@ -110,6 +106,27 @@ Copy the NUMA header files and lib to the cross
> compiler's directories:
>     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/
> 
> +.. note::
> +
> +   Using LDFLAGS and CFLAGS is not a viable alternative to copying the files.
> +   The Meson docs say it is not recommended, as there are many caveats to
> their
> +   use with Meson, especially when rebuilding the project. A viable
> alternative
> +   would be to use the ``c_args`` and ``c_link_args`` options with Meson
> 0.51.0
> +   and higher:
> +
> +.. code-block:: console
> +
> +   -Dc_args=-I<numa_install_dir>/include
> + -Dc_link_args=-L<numa_install_dir>/lib
> +
> +   For Meson versions lower than 0.51.0, the ``c_args`` and ``c_link_args``
> +   options don't apply to cross compilation. However, the compiler/linker
> flags
> +   may be added to cross files under [properties]:
These 3 lines need no indent, otherwise they will be rendered in code-block.
With suggested change:
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>

> +
> +.. code-block:: console
> +
> +   c_args = ['-I<numa_install_dir>/include']
> +   c_link_args = ['-L<numa_install_dir>/lib']
> +
>  Cross Compiling DPDK with GNU toolchain using Meson
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> --
> 2.20.1
  

Patch

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 d59af58235..51075bd4a9 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -98,10 +98,6 @@  For aarch32::
 Augment the GNU toolchain with NUMA support
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-.. note::
-
-   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
@@ -110,6 +106,27 @@  Copy the NUMA header files and lib to the cross compiler's directories:
    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/
 
+.. note::
+
+   Using LDFLAGS and CFLAGS is not a viable alternative to copying the files.
+   The Meson docs say it is not recommended, as there are many caveats to their
+   use with Meson, especially when rebuilding the project. A viable alternative
+   would be to use the ``c_args`` and ``c_link_args`` options with Meson 0.51.0
+   and higher:
+
+.. code-block:: console
+
+   -Dc_args=-I<numa_install_dir>/include -Dc_link_args=-L<numa_install_dir>/lib
+
+   For Meson versions lower than 0.51.0, the ``c_args`` and ``c_link_args``
+   options don't apply to cross compilation. However, the compiler/linker flags
+   may be added to cross files under [properties]:
+
+.. code-block:: console
+
+   c_args = ['-I<numa_install_dir>/include']
+   c_link_args = ['-L<numa_install_dir>/lib']
+
 Cross Compiling DPDK with GNU toolchain using Meson
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~