From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F3433A0093 for ; Tue, 19 May 2020 14:59:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E9FB01D5FB; Tue, 19 May 2020 14:59:25 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by dpdk.org (Postfix) with ESMTP id 056AC1D5FB for ; Tue, 19 May 2020 14:59:25 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id j5so15853896wrq.2 for ; Tue, 19 May 2020 05:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lYwT7gmxseBQX96rJS2359DTM+6l/7LpTke/q9APG0M=; b=rs31+dKcbCeGcgpla5gGJgTobmMFeCtQiXLXeQwcwhtci20Kqdrlrvd0Bc7WfSJVN+ SG9f4A5GoPcGos6EePw3zuk2+O5L2xj8O9elHZQBxgltUvWvatDLxUx4h0c59nUBN7FM fmTLggD4Yd8/T0Mdl8u5iezLMwq7V2BlX2GBH+vaqkXhZunryWhq9NhuQODbboW8Pc/f mWDv5OFjAwEKEYR61aX5Jqjq69/2/hUDJTLPpIX1ibs6z7JiEZG/Gtbsu3CSY8YXl6QW 8Irlm4aP8O+iLjVNkRHgtiUkgGNv3byevarrAHuKSkIrIbXRoWI0JYLDuWGjJkNiYCgS wfYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lYwT7gmxseBQX96rJS2359DTM+6l/7LpTke/q9APG0M=; b=S/nTmw4gpOcju4Bv6qM6oPKbj3zBvreB+Bq/AAuRw3+6a5+Z5barZ6W+FztOeE0U3X v+SapNR3wrK6oTspUbMaWvFkiDDGdcrJxQQErtv2B1aEIfGm092rtI+cJz1ShwSqs3Fd 3tilz5HyiGRHr9MhV9ZozVmRx8A7WbMuZt65vxxMlQPdaUTck00nA4nJkt5Euw/bFinB WJRqbbncl++NACmotLea4wzPP65m7hPhKLmH9+gAdvMS8yY3NL8y1vjqhnKt+Md/oF3j HNPPo7SIv3gH4k8ZeoqN+o8U2zfyBJnhWeUsVFw3SIEhBFhNOBfP/gUIZFrv59RVetWK SR5w== X-Gm-Message-State: AOAM5325q/cjoGfYPp/pza+nlMjkypmLUUzXrawjobjkvihD/lpN+RZb C26ajzO5QPcuDLppFCzY8Oc= X-Google-Smtp-Source: ABdhPJyt6jGgSd1bjvd7N7xG0KNC7Kj3puH5OmbBLanJfQ3ODRHIofBGmVookCYeZ7rhfy5zSThEvQ== X-Received: by 2002:adf:a285:: with SMTP id s5mr28305812wra.60.1589893164693; Tue, 19 May 2020 05:59:24 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id v8sm21444638wrs.45.2020.05.19.05.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:59:24 -0700 (PDT) From: luca.boccassi@gmail.com To: Dmitry Kozlyuk Cc: William Tu , Pallavi Kadam , dpdk stable Date: Tue, 19 May 2020 13:53:42 +0100 Message-Id: <20200519125804.104349-32-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519125804.104349-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'build: support MinGW-w64 with Meson' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From ba2322fb9af1b148b640dfdcb2e3a2569a3bb1b1 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Thu, 27 Feb 2020 07:25:34 +0300 Subject: [PATCH] build: support MinGW-w64 with Meson [ upstream commit 4816484bab8eeb05e83bcf4787772eb3b75fa6ee ] MinGW-w64 linker does not mimic MS linker options, so the build system must differentiate between linkers on Windows. Use GNU linker options with GCC and MS linker options with Clang. MinGW-w64 by default uses MSVCRT stdio, which does not comply to ANSI, most notably its formatting and string handling functions. MinGW-w64 support for the Universal CRT (UCRT) is ongoing, but the toolchain provides its own standard-complying implementation of stdio. The latter is used in the patch to support formatting in DPDK. Signed-off-by: Dmitry Kozlyuk Tested-by: William Tu Tested-by: Pallavi Kadam --- config/meson.build | 14 ++++++++ doc/guides/windows_gsg/build_dpdk.rst | 51 ++++++++++++++++++++++----- lib/meson.build | 8 +++-- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/config/meson.build b/config/meson.build index cdbe724754..35ef12e30c 100644 --- a/config/meson.build +++ b/config/meson.build @@ -14,6 +14,10 @@ foreach env:supported_exec_envs set_variable('is_' + env, exec_env == env) endforeach +# MS linker requires special treatment. +# TODO: use cc.get_linker_id() with Meson >= 0.54 +is_ms_linker = is_windows and (cc.get_id() == 'clang') + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.') @@ -235,6 +239,16 @@ if is_freebsd add_project_arguments('-D__BSD_VISIBLE', language: 'c') endif +if is_windows + # Minimum supported API is Windows 7. + add_project_arguments('-D_WIN32_WINNT=0x0601', language: 'c') + + # Use MinGW-w64 stdio, because DPDK assumes ANSI-compliant formatting. + if cc.get_id() == 'gcc' + add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c') + endif +endif + if get_option('b_lto') if cc.has_argument('-ffat-lto-objects') add_project_arguments('-ffat-lto-objects', language: 'c') diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst index 6711e07e21..a0e51dfcb3 100644 --- a/doc/guides/windows_gsg/build_dpdk.rst +++ b/doc/guides/windows_gsg/build_dpdk.rst @@ -7,15 +7,22 @@ Compiling the DPDK Target from Source System Requirements ------------------- -The DPDK and its applications require the Clang-LLVM C compiler -and Microsoft MSVC linker. +Building the DPDK and its applications 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. The installation of these tools is covered in this section. +Option 1. Clang-LLVM C Compiler and Microsoft MSVC Linker +--------------------------------------------------------- + Install the Compiler --------------------- +~~~~~~~~~~~~~~~~~~~~ Download and install the clang compiler from `LLVM website `_. @@ -25,7 +32,7 @@ For example, Clang-LLVM direct download link:: Install the Linker ------------------- +~~~~~~~~~~~~~~~~~~ Download and install the Build Tools for Visual Studio to link and build the files on windows, @@ -34,6 +41,18 @@ When installing build tools, select the "Visual C++ build tools" option and ensure the Windows SDK is selected. +Option 2. MinGW-w64 Toolchain +----------------------------- + +Obtain the latest version from +`MinGW-w64 website `_. +On Windows, install to a folder without spaces in its name, like ``C:\MinGW``. +This path is assumed for the rest of this guide. + +Version 4.0.4 for Ubuntu 16.04 cannot be used due to a +`MinGW-w64 bug `_. + + Install the Build System ------------------------ @@ -43,6 +62,8 @@ A good option to choose is the MSI installer for both meson and ninja together:: http://mesonbuild.com/Getting-meson.html#installing-meson-and-ninja-with-the-msi-installer%22 +Recommended version is either Meson 0.47.1 (baseline) or the latest release. + Install the Backend ------------------- @@ -56,23 +77,30 @@ Build the code The build environment is setup to build the EAL and the helloworld example by default. -Using the ninja backend -~~~~~~~~~~~~~~~~~~~~~~~~ +Option 1. Native Build on Windows +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Specifying the compiler might be required to complete the meson command. +When using Clang-LLVM, specifying the compiler might be required to complete +the meson command: .. code-block:: console set CC=clang +When using MinGW-w64, it is sufficient to have toolchain executables in PATH: + +.. code-block:: console + + set PATH=C:\MinGW\mingw64\bin;%PATH% + To compile the examples, the flag ``-Dexamples`` is required. .. code-block:: console cd C:\Users\me\dpdk meson -Dexamples=helloworld build - cd build - ninja + ninja -C build + Run the helloworld example ========================== @@ -87,3 +115,8 @@ Navigate to the examples in the build directory and run `dpdk-helloworld.exe`. hello from core 3 hello from core 0 hello from core 2 + +Note for MinGW-w64: applications are linked to ``libwinpthread-1.dll`` +by default. To run the example, either add toolchain executables directory +to the PATH or copy the library to the working directory. +Alternatively, static linking may be used (mind the LGPLv2.1 license). diff --git a/lib/meson.build b/lib/meson.build index 6ceb5e756e..d5a507fb43 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -148,12 +148,16 @@ foreach l:libraries command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'], input: version_map, output: 'rte_@0@_exports.def'.format(name)) - lk_deps = [version_map, def_file] - if is_windows + + if is_ms_linker lk_args = ['-Wl,/def:' + def_file.full_path(), '-Wl,/implib:lib\\' + implib] else lk_args = ['-Wl,--version-script=' + version_map] + endif + + lk_deps = [version_map, def_file] + if not is_windows # on unix systems check the output of the # experimental syms script, using it as a # dependency of the .so build -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 13:56:20.146919919 +0100 +++ 0032-build-support-MinGW-w64-with-Meson.patch 2020-05-19 13:56:18.223501891 +0100 @@ -1,8 +1,10 @@ -From 4816484bab8eeb05e83bcf4787772eb3b75fa6ee Mon Sep 17 00:00:00 2001 +From ba2322fb9af1b148b640dfdcb2e3a2569a3bb1b1 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Thu, 27 Feb 2020 07:25:34 +0300 Subject: [PATCH] build: support MinGW-w64 with Meson +[ upstream commit 4816484bab8eeb05e83bcf4787772eb3b75fa6ee ] + MinGW-w64 linker does not mimic MS linker options, so the build system must differentiate between linkers on Windows. Use GNU linker options with GCC and MS linker options with Clang. @@ -23,7 +25,7 @@ 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/config/meson.build b/config/meson.build -index d3d2370ce4..68aeb84703 100644 +index cdbe724754..35ef12e30c 100644 --- a/config/meson.build +++ b/config/meson.build @@ -14,6 +14,10 @@ foreach env:supported_exec_envs @@ -37,7 +39,7 @@ # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.') -@@ -247,6 +251,16 @@ if is_freebsd +@@ -235,6 +239,16 @@ if is_freebsd add_project_arguments('-D__BSD_VISIBLE', language: 'c') endif @@ -167,7 +169,7 @@ +to the PATH or copy the library to the working directory. +Alternatively, static linking may be used (mind the LGPLv2.1 license). diff --git a/lib/meson.build b/lib/meson.build -index 0af3efab29..9c3cc55d5e 100644 +index 6ceb5e756e..d5a507fb43 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -148,12 +148,16 @@ foreach l:libraries