[v3,2/7] Section 2: Install and Build DPDK

Message ID 20231103040202.2849-3-dave@youngcopy.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series docs: getting started guide consolidation |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Dave Young Nov. 3, 2023, 4:01 a.m. UTC
  Section 2: Install and Build DPDK - Updated based on feedback; Merged windows_install_build.rst into building_from_sources.rst; Updated Meson 0.57.x to be required for Windows.
---
 .../building_from_sources.rst                 | 174 ++++++++++++++++++
 .../install_and_build/index.rst               |  14 ++
 .../installing_prebuilt_packages.rst          |  54 ++++++
 3 files changed, 242 insertions(+)
 create mode 100644 doc/guides/getting_started_guide/install_and_build/building_from_sources.rst
 create mode 100644 doc/guides/getting_started_guide/install_and_build/index.rst
 create mode 100644 doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst
  

Comments

Bruce Richardson Nov. 3, 2023, 1:55 p.m. UTC | #1
Thanks, David. More comments inline below.

/Bruce

On Fri, Nov 03, 2023 at 12:01:48AM -0400, David Young wrote:
> Section 2: Install and Build DPDK - Updated based on feedback; Merged windows_install_build.rst into building_from_sources.rst; Updated Meson 0.57.x to be required for Windows.

Please word-wrap commit log.

> ---
>  .../building_from_sources.rst                 | 174 ++++++++++++++++++
>  .../install_and_build/index.rst               |  14 ++
>  .../installing_prebuilt_packages.rst          |  54 ++++++
>  3 files changed, 242 insertions(+)
>  create mode 100644 doc/guides/getting_started_guide/install_and_build/building_from_sources.rst
>  create mode 100644 doc/guides/getting_started_guide/install_and_build/index.rst
>  create mode 100644 doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst
> 
> diff --git a/doc/guides/getting_started_guide/install_and_build/building_from_sources.rst b/doc/guides/getting_started_guide/install_and_build/building_from_sources.rst
> new file mode 100644
> index 0000000000..fd7e2e9b30
> --- /dev/null
> +++ b/doc/guides/getting_started_guide/install_and_build/building_from_sources.rst
> @@ -0,0 +1,174 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright(c) 2010-2025 Intel Corporation.
> +
> +.. _building_from_sources:
> +
> +Building and Installing DPDK from Sources
> +=========================================
> +
> +This chapter provides a comprehensive guide for building DPDK from sources on Linux, FreeBSD, and Windows. It covers the necessary steps, prerequisites, 
> +and considerations for different architectures and compilers.
> +

I wonder if we need so many repetitions of "Linux, FreeBSD and Windows". We
just referred to them in the previous intro section.

> +Required Tools
> +--------------
> +
> +To build DPDK, you'll need the following tools:
> +
> +- A C compiler like ``gcc`` (version 5+) or ``clang`` (version 3.6+)
> +- ``pkg-config`` or ``pkgconf``
> +- Python 3.6 or later
> +- ``meson`` (version 0.57.0) and ``ninja``
> +- ``pyelftools`` (version 0.22+)
> +
> +Platform-Specific Tool Installation
> +-----------------------------------
> +
> +Linux
> +^^^^^
> +
> +Common Tools for All Distributions:
> +
> +.. code-block:: bash
> +
> +   sudo apt install gcc pkg-config python3 meson ninja pyelftools
> +

The tools may be common, but the command is for debian and derivatives like
Ubuntu. Can you fold these packages into the individual lists per-distro
below, since "apt install" doesn't work on Fedora or openSUSE.

> +Alpine
> +
> +.. code-block:: bash
> +
> +   sudo apk add alpine-sdk bsd-compat-headers
> +
> +Debian, Ubuntu, and derivatives
> +
> +.. code-block:: bash
> +
> +   sudo apt install build-essential
> +
> +Fedora and RedHat Enterprise Linux RHEL
> +
> +.. code-block:: bash
> +
> +   sudo dnf groupinstall "Development Tools"
> +
> +openSUSE
> +
> +.. code-block:: bash
> +
> +   sudo zypper install -t pattern devel_basis python3-pyelftools
> +

Looking through these package lists, I think we need to add libnuma
development packages to them. For debian/ubuntu, that would be
"libnuma-dev". For Fedora, I think it's "numactl-devel".

> +FreeBSD
> +^^^^^^^
> +
> +Common Tools for FreeBSD:
> +
> +.. code-block:: bash
> +
> +   pkg install gcc pkgconf python3 meson ninja pyelftools

Actually, we don't need gcc here. FreeBSD comes with clang and uses it as
the default compiler.

> +
> +.. note::
> +
> +   If you're using FreeBSD, make sure kernel sources are included during the FreeBSD installation.
> +
> +Windows System Requirements
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Building the DPDK and its applications on Windows requires one of the following
> +environments:
> +
> +- The Clang-LLVM C compiler and Microsoft MSVC linker.
> +- The MinGW-w64 toolchain (either native or cross).
> +
> +The Meson Build system is used to prepare the sources for compilation with the Ninja backend.
> +
> +Option 1: Clang-LLVM C Compiler and Microsoft MSVC Linker
> +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
> +
> +1. Install the Compiler: Download and install the Clang compiler from the 
> +   `LLVM website <http://releases.llvm.org/>`_.
> +
> +2. Install the Linker: Download and install the Build Tools for Visual Studio from the
> +   `Microsoft website <https://visualstudio.microsoft.com/downloads/>`_.
> +   When installing build tools, select the “Visual C++ build tools” option and make sure
> +   the Windows SDK is selected.
> +
> +Option 2: MinGW-w64 Toolchain
> +""""""""""""""""""""""""""""""
> +
> +1. On Linux (for cross-compilation): Install MinGW-w64 via a package manager. 
> +   Version 4.0.4 for Ubuntu 16.04 cannot be used due to a MinGW-w64 bug.
> +
> +2. On Windows: Obtain the latest version installer from the
> +   `MinGW-w64 repository <https://mingw-w64.org/doku.php>`_. 
> +   Any thread model (POSIX or Win32) can be chosen, DPDK does not rely on it. 
> +   Install to a folder without spaces in its name, like ``C:\MinGW``. 
> +   This path is assumed for the rest of this guide.
> +
> +Install the Build System
> +^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Download and install the build system from the
> +`Meson website <http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer>`_.
> +A good option to choose is the MSI installer for both meson and ninja together.
> +Required version is Meson 0.57.x (baseline).
> +
> +Getting the DPDK Source
> +-----------------------
> +
> +Linux and FreeBSD
> +^^^^^^^^^^^^^^^^^
> +
> +.. code-block:: bash
> +
> +   wget https://fast.dpdk.org/rel/dpdk-<version>.tar.xz
> +   tar -xvf dpdk-<version>.tar.xz

For "xz" files, I believe tar uses -J flag, so this should be "tar -xJf",
not "tar -xvf"

> +   cd dpdk-<version>
> +
> +Windows
> +^^^^^^^
> +
> +Download the DPDK source code from `DPDK's official website <https://www.dpdk.org/>`_ or clone the repository using a Git client. Extract the downloaded archive, if applicable, and navigate to the DPDK directory.
> +
> +Navigate to the directory where the DPDK source code is located:
> +
> +.. code-block:: bash
> +
> +   cd C:\path\to\dpdk-<version>
> +
> +Building DPDK
> +-------------
> +
> +Linux and FreeBSD
> +^^^^^^^^^^^^^^^^^
> +
> +.. code-block:: bash
> +
> +   meson build

"meson build" now gives a warning with latest versions of meson, since we
don't specify and operation. Change this to "meson setup build".
You should add a note immediately after the "Building DPDK" header, stating
that in all examples "build" is used as the name of the build directory.
This should ensure readers don't think it's part of the command itself.

> +   ninja -C build

For consistency with windows, do we want to change this to "meson compile
-C build"?

If we do, it would allow us to have subsections only for "configuring the
build with meson" and have a common "build" section if we want. [I don't
think we should do this yet, but we may want to in future].

> +
> +Windows
> +^^^^^^^
> +
> +**Option 1: Using Clang-LLVM**
> +
> +.. code-block:: bash
> +
> +   set CC=clang
> +   meson setup -Dexamples=helloworld build
> +   meson compile -C build
> +
> +**Option 2: Using MinGW-w64**
> +
> +.. code-block:: bash
> +
> +   set PATH=C:\MinGW\mingw64\bin;%PATH%
> +   meson setup -Dexamples=helloworld build
> +   meson compile -C build
> +
> +.. note::
> +
> +   For detailed information on Meson build configuration options specific to DPDK, see :ref:`DPDK Meson Build Configuration Options <dpdk_meson_build_options>`.
> +
> +Cross-Compilation Instructions for Different Architectures
> +----------------------------------------------------------
> +
> +For instructions on building DPDK for ARM64, LoongArch, and RISC-V, refer to :ref:`cross_compile_dpdk`.
> \ No newline at end of file
> diff --git a/doc/guides/getting_started_guide/install_and_build/index.rst b/doc/guides/getting_started_guide/install_and_build/index.rst
> new file mode 100644
> index 0000000000..48e438282f
> --- /dev/null
> +++ b/doc/guides/getting_started_guide/install_and_build/index.rst
> @@ -0,0 +1,14 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright(c) 2010-2025 Intel Corporation.
> +
> +.. _install_and_build:
> +
> +Install and Build DPDK
> +======================
> +
> +.. toctree::
> +    :maxdepth: 2
> +
> +    
> +    installing_prebuilt_packages
> +    building_from_sources
> \ No newline at end of file
> diff --git a/doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst b/doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst
> new file mode 100644
> index 0000000000..3e395d65f1
> --- /dev/null
> +++ b/doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst
> @@ -0,0 +1,54 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright(c) 2010-2025 Intel Corporation.
> +
> +.. _installing_prebuilt_packages:
> +
> +Installing Pre-built Packages
> +=============================
> +
> +Pre-built packages provide a convenient way to install DPDK without the need to compile
> +the source code manually. These packages are created and maintained by the DPDK
> +community or OS vendors and are available for various operating systems and
> +distributions.
> +
> +Available Distributions
> +-----------------------
> +
> +Linux
> +^^^^^
> +
> +Pre-built DPDK packages are available for several popular Linux distributions,
> +including but not limited to:
> +
> +Alpine
> +
> +.. code-block:: bash
> +
> +   sudo apk add dpdk
> +
> +Debian and Ubuntu and derivatives
> +
> +.. code-block:: bash
> +
> +   sudo apt-get install dpdk
> +
> +Fedora and RedHat Enterprise Linux RHEL
> +
> +.. code-block:: bash
> +
> +   sudo dnf install dpdk
> +
> +openSUSE
> +
> +.. code-block:: bash
> +
> +   sudo zypper install dpdk
> +
> +FreeBSD
> +^^^^^^^
> +
> +To install DPDK on FreeBSD, use the following command:
> +
> +.. code-block:: bash
> +
> +   sudo pkg install dpdk

Update this to dpdk-20.11, since that is the latest DPDK version available
(sadly) at this time. I need to chase up more on getting 22.11 merged
there, and soon 23.11!

> \ No newline at end of file
> -- 
> 2.41.0.windows.1
>
  

Patch

diff --git a/doc/guides/getting_started_guide/install_and_build/building_from_sources.rst b/doc/guides/getting_started_guide/install_and_build/building_from_sources.rst
new file mode 100644
index 0000000000..fd7e2e9b30
--- /dev/null
+++ b/doc/guides/getting_started_guide/install_and_build/building_from_sources.rst
@@ -0,0 +1,174 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2010-2025 Intel Corporation.
+
+.. _building_from_sources:
+
+Building and Installing DPDK from Sources
+=========================================
+
+This chapter provides a comprehensive guide for building DPDK from sources on Linux, FreeBSD, and Windows. It covers the necessary steps, prerequisites, 
+and considerations for different architectures and compilers.
+
+Required Tools
+--------------
+
+To build DPDK, you'll need the following tools:
+
+- A C compiler like ``gcc`` (version 5+) or ``clang`` (version 3.6+)
+- ``pkg-config`` or ``pkgconf``
+- Python 3.6 or later
+- ``meson`` (version 0.57.0) and ``ninja``
+- ``pyelftools`` (version 0.22+)
+
+Platform-Specific Tool Installation
+-----------------------------------
+
+Linux
+^^^^^
+
+Common Tools for All Distributions:
+
+.. code-block:: bash
+
+   sudo apt install gcc pkg-config python3 meson ninja pyelftools
+
+Alpine
+
+.. code-block:: bash
+
+   sudo apk add alpine-sdk bsd-compat-headers
+
+Debian, Ubuntu, and derivatives
+
+.. code-block:: bash
+
+   sudo apt install build-essential
+
+Fedora and RedHat Enterprise Linux RHEL
+
+.. code-block:: bash
+
+   sudo dnf groupinstall "Development Tools"
+
+openSUSE
+
+.. code-block:: bash
+
+   sudo zypper install -t pattern devel_basis python3-pyelftools
+
+FreeBSD
+^^^^^^^
+
+Common Tools for FreeBSD:
+
+.. code-block:: bash
+
+   pkg install gcc pkgconf python3 meson ninja pyelftools
+
+.. note::
+
+   If you're using FreeBSD, make sure kernel sources are included during the FreeBSD installation.
+
+Windows System Requirements
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Building the DPDK and its applications on Windows requires one of the following
+environments:
+
+- The Clang-LLVM C compiler and Microsoft MSVC linker.
+- The MinGW-w64 toolchain (either native or cross).
+
+The Meson Build system is used to prepare the sources for compilation with the Ninja backend.
+
+Option 1: Clang-LLVM C Compiler and Microsoft MSVC Linker
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+1. Install the Compiler: Download and install the Clang compiler from the 
+   `LLVM website <http://releases.llvm.org/>`_.
+
+2. Install the Linker: Download and install the Build Tools for Visual Studio from the
+   `Microsoft website <https://visualstudio.microsoft.com/downloads/>`_.
+   When installing build tools, select the “Visual C++ build tools” option and make sure
+   the Windows SDK is selected.
+
+Option 2: MinGW-w64 Toolchain
+""""""""""""""""""""""""""""""
+
+1. On Linux (for cross-compilation): Install MinGW-w64 via a package manager. 
+   Version 4.0.4 for Ubuntu 16.04 cannot be used due to a MinGW-w64 bug.
+
+2. On Windows: Obtain the latest version installer from the
+   `MinGW-w64 repository <https://mingw-w64.org/doku.php>`_. 
+   Any thread model (POSIX or Win32) can be chosen, DPDK does not rely on it. 
+   Install to a folder without spaces in its name, like ``C:\MinGW``. 
+   This path is assumed for the rest of this guide.
+
+Install the Build System
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Download and install the build system from the
+`Meson website <http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer>`_.
+A good option to choose is the MSI installer for both meson and ninja together.
+Required version is Meson 0.57.x (baseline).
+
+Getting the DPDK Source
+-----------------------
+
+Linux and FreeBSD
+^^^^^^^^^^^^^^^^^
+
+.. code-block:: bash
+
+   wget https://fast.dpdk.org/rel/dpdk-<version>.tar.xz
+   tar -xvf dpdk-<version>.tar.xz
+   cd dpdk-<version>
+
+Windows
+^^^^^^^
+
+Download the DPDK source code from `DPDK's official website <https://www.dpdk.org/>`_ or clone the repository using a Git client. Extract the downloaded archive, if applicable, and navigate to the DPDK directory.
+
+Navigate to the directory where the DPDK source code is located:
+
+.. code-block:: bash
+
+   cd C:\path\to\dpdk-<version>
+
+Building DPDK
+-------------
+
+Linux and FreeBSD
+^^^^^^^^^^^^^^^^^
+
+.. code-block:: bash
+
+   meson build
+   ninja -C build
+
+Windows
+^^^^^^^
+
+**Option 1: Using Clang-LLVM**
+
+.. code-block:: bash
+
+   set CC=clang
+   meson setup -Dexamples=helloworld build
+   meson compile -C build
+
+**Option 2: Using MinGW-w64**
+
+.. code-block:: bash
+
+   set PATH=C:\MinGW\mingw64\bin;%PATH%
+   meson setup -Dexamples=helloworld build
+   meson compile -C build
+
+.. note::
+
+   For detailed information on Meson build configuration options specific to DPDK, see :ref:`DPDK Meson Build Configuration Options <dpdk_meson_build_options>`.
+
+Cross-Compilation Instructions for Different Architectures
+----------------------------------------------------------
+
+For instructions on building DPDK for ARM64, LoongArch, and RISC-V, refer to :ref:`cross_compile_dpdk`.
\ No newline at end of file
diff --git a/doc/guides/getting_started_guide/install_and_build/index.rst b/doc/guides/getting_started_guide/install_and_build/index.rst
new file mode 100644
index 0000000000..48e438282f
--- /dev/null
+++ b/doc/guides/getting_started_guide/install_and_build/index.rst
@@ -0,0 +1,14 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2010-2025 Intel Corporation.
+
+.. _install_and_build:
+
+Install and Build DPDK
+======================
+
+.. toctree::
+    :maxdepth: 2
+
+    
+    installing_prebuilt_packages
+    building_from_sources
\ No newline at end of file
diff --git a/doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst b/doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst
new file mode 100644
index 0000000000..3e395d65f1
--- /dev/null
+++ b/doc/guides/getting_started_guide/install_and_build/installing_prebuilt_packages.rst
@@ -0,0 +1,54 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2010-2025 Intel Corporation.
+
+.. _installing_prebuilt_packages:
+
+Installing Pre-built Packages
+=============================
+
+Pre-built packages provide a convenient way to install DPDK without the need to compile
+the source code manually. These packages are created and maintained by the DPDK
+community or OS vendors and are available for various operating systems and
+distributions.
+
+Available Distributions
+-----------------------
+
+Linux
+^^^^^
+
+Pre-built DPDK packages are available for several popular Linux distributions,
+including but not limited to:
+
+Alpine
+
+.. code-block:: bash
+
+   sudo apk add dpdk
+
+Debian and Ubuntu and derivatives
+
+.. code-block:: bash
+
+   sudo apt-get install dpdk
+
+Fedora and RedHat Enterprise Linux RHEL
+
+.. code-block:: bash
+
+   sudo dnf install dpdk
+
+openSUSE
+
+.. code-block:: bash
+
+   sudo zypper install dpdk
+
+FreeBSD
+^^^^^^^
+
+To install DPDK on FreeBSD, use the following command:
+
+.. code-block:: bash
+
+   sudo pkg install dpdk
\ No newline at end of file