From patchwork Thu Feb 6 06:44:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65608 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6AF07A04FA; Thu, 6 Feb 2020 07:44:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 369911C001; Thu, 6 Feb 2020 07:44:42 +0100 (CET) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id 9F5F61BFAA for ; Thu, 6 Feb 2020 07:44:39 +0100 (CET) Received: by mail-lf1-f65.google.com with SMTP id n25so3292095lfl.0 for ; Wed, 05 Feb 2020 22:44:39 -0800 (PST) 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=l213dkCU/FdwVGhbbD3agoLOcLpWMuN2wM7qnDC+fVM=; b=nJ/6pMCyv+CrT/+WZJCdTNIkl7e+q5s+FYQxTSytZ0z9rrDtdcoZ5y1Ss9jpyP/XkL FsdA74wT2vDBaAqYkFioCp+mwCf8DIdJn7tmKMu4Ai8TGCjkcu+buWGip6vLHFebtX6X mG9v4Xy83u7pkFf4PE4IkoqcSo81CpvHsBEE6uWxce0IzpCTLs0cukfZq5hue2fo/vtk 2sICcW+s0gJVoKYJTQ6no6esi4LTP6fuj4NLXUbfBnHGlMkcq3E+gn0MkErtqye9QSy6 dwEx3Q9oXGJ+wfADUNAmqR5wlIGcK3xl84opOxsAbO1tkE2s9CKguduQVsK9cDySHuxU WjUg== 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=l213dkCU/FdwVGhbbD3agoLOcLpWMuN2wM7qnDC+fVM=; b=q/3X8arrcdL4+peSKyCj57z4GiPDjxt1hGls7r0j3itjQpSGcgF6vm+L072+Lqko2j 9lk1s/es2WZqignlfj6tu7BK24ZPfVndeOweA9aUIRbfaQDvWWjWLpSgWO/b8Xth1ftU +sAbxVQvBQuyXDMfwPsJK7GhBEiCl8sIkFFK9PqQBJFTEQj9HqKNX7Hp47Ae0ObzLNet FUQHl41NaiDoknzSqG4lfiMc67aPkqUM8AKeGcIK+BIAVTnwByTY6034RJUl5HHRGmRk 2xOvi+9o6kUBTTxpNDKCyYkZRGxaEsyQqiz53PGJR8sGw5BPKA/Cq4x85EopcS1JNuIH /Gjw== X-Gm-Message-State: APjAAAXp2/GdxAeTtMTpLZ6VFC5OdL/ZkLSktzV8K3LQOZ46kdUVwcDX QbX6MDP5vAbK2XGBhR5J+gB8mosljSU= X-Google-Smtp-Source: APXvYqz2vcFgEf6XI8R6VlMh6OZGm/TMhbEiWlV7PMa5gLgik/ssp77Exr1wtsXcLmw3bYTaeA8U7Q== X-Received: by 2002:ac2:482c:: with SMTP id 12mr916987lft.163.1580971478993; Wed, 05 Feb 2020 22:44:38 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:38 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk Date: Thu, 6 Feb 2020 09:44:20 +0300 Message-Id: <20200206064426.45697-2-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 1/7] eal: introduce portable format attribute X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When using __attribute__((format(...)) on functions, GCC on Windows assumes MS-specific format string by default, even if the underlying stdio implementation is ANSI-compliant (either MS Unicersal CRT or MinGW implementation). Wrap attribute into a macro that forces GNU-specific format string when using GCC. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/common/include/rte_common.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 4b5f3a31f..2f086bb9c 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -89,6 +89,21 @@ typedef uint16_t unaligned_uint16_t; */ #define RTE_SET_USED(x) (void)(x) +/** + * Check format string and its arguments at compile-time. + * + * GCC on Windows assumes MS-specific format string by default, + * even if the underlying stdio implementation is ANSI-compliant, + * so this must be overridden. + */ +#if defined(RTE_TOOLCHAIN_GCC) +#define __rte_format(archetype, format_index, first_arg) \ + __attribute__((format(gnu_##archetype, format_index, first_arg))) +#else +#define __rte_format(archetype, format_index, first_arg) \ + __attribute__((format(archetype, format_index, first_arg))) +#endif + #define RTE_PRIORITY_LOG 101 #define RTE_PRIORITY_BUS 110 #define RTE_PRIORITY_CLASS 120 From patchwork Thu Feb 6 06:44:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65609 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52AF0A04FA; Thu, 6 Feb 2020 07:45:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8CA9D1C025; Thu, 6 Feb 2020 07:44:43 +0100 (CET) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by dpdk.org (Postfix) with ESMTP id 7BB291BFAA for ; Thu, 6 Feb 2020 07:44:40 +0100 (CET) Received: by mail-lj1-f173.google.com with SMTP id d10so4860976ljl.9 for ; Wed, 05 Feb 2020 22:44:40 -0800 (PST) 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=onHpZxFRZr6ufes+hi2kn4mm+vpbAuHtSS11alSU2xk=; b=N75lKsVrrctkz6LuE0ZCoYXt6tWEbPuWUbxromxHX4JSufogv4uEJdmg10YBvQB7Ko 1jEhBys6iOw6JOWd8JeUtxHOG02bb5vmvmHahNGIE1hn+Xlvim48uXJQUZaCgazuqc+9 OcJSK6Ja2lkPdU7yTlB8fCu8PNur9LWyPB886ugtr4YniYX0LPdhf5QW3Bx6HwfcTgYt MH0afgF8yH+hnEj+x4mlNTTU93mn2QUsFJ/lqCxt9xDoZgt3amgcdXw+Y/3ExOkUps1A QOJI0GCI6hpMy4e1SFBB7uM3JBx1NpbU+8KLnANzKR/NSP92K0yEpaGSoMYQUwc1/EqJ 8KVA== 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=onHpZxFRZr6ufes+hi2kn4mm+vpbAuHtSS11alSU2xk=; b=lLGT9vkcX1yS7yieRyN0XZ0JjDNqnUwE/Fp5C1Rj/9CJTFFrvhQENz87MKqAyzMghE EC2AgSsO0TCH3YGKlHxcpLdKUyB4BBOqrq15b/aoGSpDuQRvcelInbyWs1FHOlfy0cJU /Ai8PNXc+t51/3lDsLiw+oQpSQiWdowDepZgdbE4s6K2NUwRMH0NtHdi8h9aImYukcul EDNJnByDCP6InBb4Mv7u37o1xTUCErNgKGU6KtOhPfACC7I719mrmn0l2wX79L85euDJ ghyZd3/Olg/byeyA69RO9eEbxIfTFwXJTpSrC/KthX4ctz4qzcI/94Td0SIcLtuT2RXF 4NsA== X-Gm-Message-State: APjAAAUqi85V7aB6kxd2GxdIA8Ho2Xb+43zVao7YtaQgQvovu83vFPjB L6v657+H/djmrZmLIiN1EjWncQFq/2w= X-Google-Smtp-Source: APXvYqxwh+oVKm/9guCdFRCfstDuEWjdZGD0fp82neVGdil2MbbO+1iHw5ka3BBvTvLYKx1IC0MUPg== X-Received: by 2002:a2e:9d89:: with SMTP id c9mr1097689ljj.212.1580971479843; Wed, 05 Feb 2020 22:44:39 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:39 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk Date: Thu, 6 Feb 2020 09:44:21 +0300 Message-Id: <20200206064426.45697-3-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 2/7] eal: use portable format attribute X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use portable format attribute for logging and panic messages. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/common/include/rte_common.h | 2 +- lib/librte_eal/common/include/rte_debug.h | 2 +- lib/librte_eal/common/include/rte_devargs.h | 2 +- lib/librte_eal/common/include/rte_log.h | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 2f086bb9c..dc406ce27 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -799,7 +799,7 @@ rte_str_to_size(const char *str) void rte_exit(int exit_code, const char *format, ...) __attribute__((noreturn)) - __attribute__((format(printf, 2, 3))); + __rte_format(printf, 2, 3); #ifdef __cplusplus } diff --git a/lib/librte_eal/common/include/rte_debug.h b/lib/librte_eal/common/include/rte_debug.h index 748d32c80..c47c6bcdc 100644 --- a/lib/librte_eal/common/include/rte_debug.h +++ b/lib/librte_eal/common/include/rte_debug.h @@ -73,7 +73,7 @@ void __rte_panic(const char *funcname , const char *format, ...) #endif #endif __attribute__((noreturn)) - __attribute__((format(printf, 2, 3))); + __rte_format(printf, 2, 3); #ifdef __cplusplus } diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 882dfa0ab..4418e02f2 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -137,7 +137,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev); int rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) -__attribute__((format(printf, 2, 0))); +__rte_format(printf, 2, 0); /** * Insert an rte_devargs in the global list. diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index 1bb0e6694..823efea4e 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -282,7 +282,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) __attribute__((cold)) #endif #endif - __attribute__((format(printf, 3, 4))); + __rte_format(printf, 3, 4); /** * Generates a log message. @@ -311,7 +311,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) * - Negative on error. */ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) - __attribute__((format(printf,3,0))); + __rte_format(printf, 3, 0); /** * Generates a log message. From patchwork Thu Feb 6 06:44:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65610 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D75F6A04FA; Thu, 6 Feb 2020 07:45:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A1C21C07D; Thu, 6 Feb 2020 07:44:45 +0100 (CET) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id 84B541BFFB for ; Thu, 6 Feb 2020 07:44:41 +0100 (CET) Received: by mail-lf1-f65.google.com with SMTP id v201so3257265lfa.11 for ; Wed, 05 Feb 2020 22:44:41 -0800 (PST) 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=Ex7yw1lQczP0ITUnFepv3CVHMb3h+CZosEwIOZGlzcM=; b=rcyhv89WWWZGiEkyG5BrbkT+CcrqFWLYpT9aZDVEbuTgQctHRGLWJ9rofblgAFjLeN MGctUOb5YXOGWsoYit5UaY0b+NZfprAnXK8t/u6UeHg2G3d+NgumKsWl9Ap+h7vsifrn gX++P8rUc+8PwMQTeohZRcTk66ZgSmxf321gvPkBdbrWaFl3aHDial8tQoHHwdYv51vb DJ/pBy+ZoAuHBh3G73FHY9NbHhHqZEFd9xJPslPRB/cxwQn/QgKu9f1+Y82E2N8iQ4+A pYGsUKxubF3zGWkXXEuclveOO7okGsjfdEKeGM55UTe0JfDnbzOBdHf2A9Tl+Bj57OUF kahA== 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=Ex7yw1lQczP0ITUnFepv3CVHMb3h+CZosEwIOZGlzcM=; b=ESOakGBvexr2ZuIRb0dlWkwws64A8f/b4J9m1oT2VpQPSp0EVmg1itT1d/hMyu3r6N TOxTUFdmEpXX6Jx8cohavDKIPWfo9htTn1nQEqP2YbY5H7Hr20dyxGLFzYEjgLXk0SUC 8tPa3QFb8zo3M7kF2G79iuhTR6OkiQvtNzgT67iuvhiz91Q2dXKmdkl2Nu1G70dVCbO5 m5ZBq6BXYK4FHz1g86iLBKi0ugWHt65XdbhSyY56e50V3j3FMQzJC9qsnd0Jpwa8kSRo A5FX1na16gFx4OLlzgXoovkrmskWF/VB0ke78p5AWlTYF0qhVDjItRRxakU7IOuAeWmt tFbw== X-Gm-Message-State: APjAAAW23hRWZ6zqUm0eSpLZ1+lEgxk164hEvD2BmJkohcGpWizU7vDx u/wO210oUXwKDxtJL7tW+7F+w5G1nT8= X-Google-Smtp-Source: APXvYqwpkK5wCFcfsl/1ArssjmFgfSFTVjhXI5BYL1aX2bbtzhudqUNXDox5UxvMTnqYfpaxQrc6hQ== X-Received: by 2002:a19:c014:: with SMTP id q20mr947312lff.208.1580971480890; Wed, 05 Feb 2020 22:44:40 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:40 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Olivier Matz Date: Thu, 6 Feb 2020 09:44:22 +0300 Message-Id: <20200206064426.45697-4-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 3/7] cmdline: use portable format attribute X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use portable format attribute for output strings. Signed-off-by: Dmitry Kozlyuk --- lib/librte_cmdline/cmdline.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h index 27d2effdf..952a50829 100644 --- a/lib/librte_cmdline/cmdline.h +++ b/lib/librte_cmdline/cmdline.h @@ -7,6 +7,8 @@ #ifndef _CMDLINE_H_ #define _CMDLINE_H_ +#include + #include #include #include @@ -34,7 +36,7 @@ struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_ void cmdline_set_prompt(struct cmdline *cl, const char *prompt); void cmdline_free(struct cmdline *cl); void cmdline_printf(const struct cmdline *cl, const char *fmt, ...) - __attribute__((format(printf,2,3))); + __rte_format(printf, 2, 3); int cmdline_in(struct cmdline *cl, const char *buf, int size); int cmdline_write_char(struct rdline *rdl, char c); From patchwork Thu Feb 6 06:44:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65611 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60417A04FA; Thu, 6 Feb 2020 07:45:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D6041C0BC; Thu, 6 Feb 2020 07:44:46 +0100 (CET) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 7F5031C014 for ; Thu, 6 Feb 2020 07:44:42 +0100 (CET) Received: by mail-lj1-f194.google.com with SMTP id v17so4876839ljg.4 for ; Wed, 05 Feb 2020 22:44:42 -0800 (PST) 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=12qzM0p7J2BqrZkWvnTWWGpRayFF6JDE0R6z409yAyY=; b=Jadlo59nS/J8aRZ+7DI/hRqLNtiNvIhgMs0VBEg1evOCkYeN88ZHsL+uhn6Y2uKlg1 W2/YTC+73hp9cJPb10XVJ+J+gC9nI5M7cWCHhSINwR1xDsWS9y51e4PoPgw17LZ//ghi XorkSPiOF/2F4tXZe2zyOdGxmmVO/l5yM1gwrdiuUzcyjidMUgmxAecrEjImka7yifMq MXQcsnWl+oT83wzcOXrrHmM9qHvPph++h3Nu3nBrO8WCJ2eoLiTu0muK9L3Gn4z2FAvt Oes0CmixrZYF1daAl2A+THKq7aksn0vCftbaxUCEUPhxQUtSKOH76+kRykxpVlDALh+A zdQg== 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=12qzM0p7J2BqrZkWvnTWWGpRayFF6JDE0R6z409yAyY=; b=MmLGsyLXOMhPeUXgXVWF3Vt5c91DmOvSBg4BdTwUFp6DMgDhrcRRgNezguZQFjo+q1 Dn+96adcBd9/k9WBuwxnjxcs+uh+0GMS5jNzpGBePJtW5rrsmmqt/RTrACflIkvXtGz+ vBU2bGrX22+U2e59vNijwmWfKfJ9KZJohu+ygb3cu2uGHf2iyMOfheeOL2V6zFdo0QnL dY2Tzwf0/V7lBvpeJY/9VJFFAPbf9Og/+4cMHUmua7WBRgPMIOhFh0fUfiES64CNhYZW 9FWm4nzVA0d9YdZLcAskSlEow6nYFObi/ZjKjd+Foi6cg9VR5I92M5shGrvWwfY1sVlZ JRkg== X-Gm-Message-State: APjAAAWockKMiIgnpSuP7ft1vH8SDC0fYMlIvE+C2icPbusGm3mBRr/m 9/dTopLHhQySixuNz/R0IrhM1D8aOyk= X-Google-Smtp-Source: APXvYqwZOsB+vlkQ6aU7plBgVOTIQPPM64y3LZW3SX+vJPuNNQKUKjjw+/yf+OZvqxcS5Kp9kcXe4A== X-Received: by 2002:a2e:8651:: with SMTP id i17mr1088524ljj.121.1580971481874; Wed, 05 Feb 2020 22:44:41 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:41 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Date: Thu, 6 Feb 2020 09:44:23 +0300 Message-Id: <20200206064426.45697-5-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 4/7] eal/windows: use lowercase filenames for system headers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Mixed case in Windows header names causes errors when cross-compiling from Linux with case-sensitive filesystem using MinGW, because MinGW distribution provides all platform SDK headers in lowercase. The change does not affect Windows native builds on case-insensitive filesystems (NTFS default). Reported-by: Narcisa Ana Maria Vasile Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/windows/eal/include/rte_os.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h index fdeae0c8f..79d41f6a9 100644 --- a/lib/librte_eal/windows/eal/include/rte_os.h +++ b/lib/librte_eal/windows/eal/include/rte_os.h @@ -15,8 +15,8 @@ extern "C" { #endif -#include -#include +#include +#include #include #define strerror_r(a, b, c) strerror_s(b, c, a) From patchwork Thu Feb 6 06:44:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65612 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48EA9A04FA; Thu, 6 Feb 2020 07:45:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C69DD1C0D4; Thu, 6 Feb 2020 07:44:47 +0100 (CET) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id C5F091C067 for ; Thu, 6 Feb 2020 07:44:43 +0100 (CET) Received: by mail-lf1-f68.google.com with SMTP id m30so3271592lfp.8 for ; Wed, 05 Feb 2020 22:44:43 -0800 (PST) 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=UGPlklvbxfQM/xywUPxBECj7HLiMr26lS5tb8VRhzNc=; b=ORQjUnBCrG6lVCOl3MYgSCP6HT3jUflTYmfvYgH5YgncPOwHEn7mvwnvfCA3cPROs7 ioOqFVdGY8AULDnODmxv/ihHf70oh5KwpplVXwZ/UOTNfNV7r+Jv4tA3PTCp8dvsdksK a2YBqLgHkkRdXPUek4uzzuHpceYB7lM+YiOP5JpmiQg30kGljSvAPx27ZwfcdeXd9QrT vvo8+z9U9froOtnkztGO55eTDG5KBakPCdQlYbV5G3Q8UqEg9aBYdVLTaGcGF2CGi+mk hfsaMLdL9mlr+VFmzplbyxMM2pXvalk8AnzMQY2CvjqSI2wv6sw+U4xzAx8YTUVenW0V kvWQ== 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=UGPlklvbxfQM/xywUPxBECj7HLiMr26lS5tb8VRhzNc=; b=UxJm4GXTYhGMyf9CM+qf5Suku2WEtuamy/wu51X+owf/GyDCnSPcSogyOqxuAd4EQc i9Bn4yWlc9m0DtSUmRDZe1HvQRlXgwCs2xiFtESBTWBQEVPvl5drL4UssD9nXmdVN86S yS+YN8xkdjHtWTShcKkVf7YnB0AuONIy3KN+808cprYmKhJADa4L54pXxwWFWjNCLQho NsYXrZUTCeKTAPveKu8YVfdb9yNzp+Id6/ujk6xgxAAaw44LgO2egogUQpE+5Ww8hSTr nesSQ0hve/cOWfC5Bz2p7WN6/tzOz/ur3nMCFzyw48PS68lzsH3njSoXqoJBtorffmZ4 Zrtw== X-Gm-Message-State: APjAAAXWLwfht/ompzU+iW7/QKXWuljoAVDbUv4IblO70wlqu7sR5T8g 8Zw6JRRU08nj3nRH9K9LnyTYlI/7NJw= X-Google-Smtp-Source: APXvYqxXORt4YUQ1pDqe7O7izuWKy64YlSPVop2EdMssbL6a6wEQr3lhYdi2aNpxacjR4JFUnkgKEg== X-Received: by 2002:ac2:52a5:: with SMTP id r5mr916663lfm.19.1580971483031; Wed, 05 Feb 2020 22:44:43 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:42 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Bruce Richardson , Thomas Monjalon Date: Thu, 6 Feb 2020 09:44:24 +0300 Message-Id: <20200206064426.45697-6-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 5/7] build: MinGW-w64 support for Meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- config/meson.build | 14 ++++++++++++++ lib/librte_eal/meson.build | 3 +++ lib/meson.build | 8 ++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config/meson.build b/config/meson.build index 28a57f56f..9b955f9ef 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. +# FIXME: 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('.') @@ -241,6 +245,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/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index 4be5118ce..eae8c2ba8 100644 --- a/lib/librte_eal/meson.build +++ b/lib/librte_eal/meson.build @@ -20,6 +20,9 @@ endif if cc.has_function('getentropy', prefix : '#include ') cflags += '-DRTE_LIBEAL_USE_GETENTROPY' endif +if cc.get_id() == 'gcc' + cflags += '-D__USE_MINGW_ANSI_STDIO' +endif sources = common_sources + env_sources objs = common_objs + env_objs headers = common_headers + env_headers diff --git a/lib/meson.build b/lib/meson.build index 0af3efab2..9c3cc55d5 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 From patchwork Thu Feb 6 06:44:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65613 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02124A04FA; Thu, 6 Feb 2020 07:45:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3AD0D1C10D; Thu, 6 Feb 2020 07:44:49 +0100 (CET) Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by dpdk.org (Postfix) with ESMTP id 7F6961C069 for ; Thu, 6 Feb 2020 07:44:44 +0100 (CET) Received: by mail-lf1-f67.google.com with SMTP id y19so3264749lfl.9 for ; Wed, 05 Feb 2020 22:44:44 -0800 (PST) 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=7eC31oXTZFs91lh/XF0hZDISHGXBX6Qg6HrhwXjOkV4=; b=luwgCT1OH1Vbieei0Ug2hHUI58zL6I4vYf5LDhtejwtXCkLNS5UzwI6xdT8xcMVMdc KeDhL+9hJpTjHea0hUBBDSGc2OmLK6dajxKpz6SXYORQ01EBLI9/2x6KaTEbQHA98NP0 wmzBEhAT7Oo/8akgawe1cibpiryqk3Nz/PyNH8xaooLpQoboaRfLvVWOI2/p+SzTFFpC yi6/HE737WhwC1WgNNv98Um9wi/XWrCTajgvbTkkxxoS5u1CNt6j6OaaI+jhCObwKvm6 CGdDCKTDGQ+yzM1vZjvfaFTxFQdDfwAcCa4XKA360F+neA03x0UkSscuUsOaeqlw4FY0 6k9w== 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=7eC31oXTZFs91lh/XF0hZDISHGXBX6Qg6HrhwXjOkV4=; b=ezW8UIx7fL+JP9fIEObKXJLM69HUIHWGwc+5+gGDswooMXZPHd/wkWjmOHmxWz5Jdo r2BfaFmKsVgIaN8hYKdStQzL14kvOCHr8P2L9hCIA/9ZrkJYFSCCiP1eSXZr59Bso0MM fwnqb0S4Lt+TRgwA+ITBz9e4hJScUe45iQGBMNcABA6h9RfHaduNiJBO5zIfsyJPwh0s kUK8f7BW7JhnGNX2g7u0NvmrKgCXZcGdQ+O2EJRv++oZQ/EmcNW+5Ncj31gnX0zFiKMM mBUeCX6HeRURe6q/YiYVB0KdCL18BF1224gN9zz3U+fOBQTq6S24Vh/zUSb/RN6E0qAo NE7A== X-Gm-Message-State: APjAAAVhwugZzy3y9veO7O3674BRXDoiE+G3xKL+aGMY8pY4ErT9lHrl IP2hXpgVirvh+B6604nUUew9WraYIH8= X-Google-Smtp-Source: APXvYqwTyqkyhKV+73QJKagezIrb0yoSwZSojTvbxTm6PLx2TnQ2knjqFP6pIsGzH5M9Dmhk7TJChQ== X-Received: by 2002:a19:844:: with SMTP id 65mr950266lfi.20.1580971483896; Wed, 05 Feb 2020 22:44:43 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:43 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Bruce Richardson , Thomas Monjalon Date: Thu, 6 Feb 2020 09:44:25 +0300 Message-Id: <20200206064426.45697-7-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 6/7] build: add cross-file for MinGW-w64 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add Meson configuration to cross-compile for Windows using MinGW-w64. It may require adjustments in some cases, but at least it provides the foundation. Signed-off-by: Dmitry Kozlyuk --- config/x86/meson_mingw.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 config/x86/meson_mingw.txt diff --git a/config/x86/meson_mingw.txt b/config/x86/meson_mingw.txt new file mode 100644 index 000000000..80f04343a --- /dev/null +++ b/config/x86/meson_mingw.txt @@ -0,0 +1,14 @@ +[binaries] +c = '/usr/bin/x86_64-w64-mingw32-gcc' +cpp = '/usr/bin/x86_64-w64-mingw32-g++' +ld = '/usr/bin/x86_64-w64-mingw32-ld' # Meson 0.53.0 +c_ld = '/usr/bin/x86_64-w64-mingw32-ld' +ar = '/usr/bin/x86_64-w64-mingw32-ar' +strip = '/usr/bin/x86_64-w64-mingw32-strip' +pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'native' +endian = 'little' From patchwork Thu Feb 6 06:44:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65614 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EBD09A04FA; Thu, 6 Feb 2020 07:46:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 347101C114; Thu, 6 Feb 2020 07:44:50 +0100 (CET) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id A4D851C0BC for ; Thu, 6 Feb 2020 07:44:45 +0100 (CET) Received: by mail-lf1-f68.google.com with SMTP id n25so3292215lfl.0 for ; Wed, 05 Feb 2020 22:44:45 -0800 (PST) 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=T+BJHT9aLjhplHlmKvEnoRrPkDvHR4a9vEMOo5TQDKc=; b=GVAGOePWw3U3eGhD3Kfhzj/AQ++pdWAqUAgoG4KSjpiGmy0tRMdtj1eIBPQkHTTElR AiIEa4DjT8wyYhrgn/SpPoyZpjBRWttzdKvuKqP8bZfmW6LrVjUvITsS/QOhRkSnV4V5 PHHSVNt3WAaMWApDdUh/tk+O8Vi+ny+9riAv3BKYHUA1Y/J8w5+qND6+uTW9NzfJWSsl KZ48jKjO7uJQd7stqL2FiwEkx0wDgM/sivHbsXPb52hxFCGdApqO+RJhtA7xsa/zxj0q UcR0OYj2kDnDKyFYyAvds9pduatI9X+4v1bn5r6XNj0m1tNJ5sqApsJx/XD/JcUR8oYm xHSw== 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=T+BJHT9aLjhplHlmKvEnoRrPkDvHR4a9vEMOo5TQDKc=; b=h1kBaPeV1220s/0K8LEiPe5pUjXTjopXk89rgrGwdMD8E1N6rLS1lwZxOQ2Sjp84c+ cXLxcnUnKLJGSuW/9NIxpvWqkc6HkBkZhnrmhalMJlBSXld6waJd7O+z7Z+OhDEOYOtp SAIwn2igBTNgNiCNqBwO1ySZLP7kSUBNAW1KZ317aSBBiwADhxuASvqAm+sRE1v+2BtG EcWBuVbkItXUG43hkPji5aWspEX3S2DCv6pDwb8f4fUfOikFUeTtuoJtiC2gvYAt8GAF 5svcs8kS+mKU5XJKWvHpfp44p6HoXlQmDOeO6QE/7xUenQUYXc70gg/etREaIb8M4icy oeng== X-Gm-Message-State: APjAAAWkDYaLeU4fizwzePFq/kxRrNj4oWwa+Tw++iH4clC2d/soYsN0 PrFm4VXI8JJcyjvma5RUNYcp0nSQxfQ= X-Google-Smtp-Source: APXvYqzKwbe9GUCZsg0fFQKLJ52uEkPucEgKcSSFHZeGM9n9U3npILqO7/VpHdKXpPzgeW4yKxtoKA== X-Received: by 2002:ac2:4436:: with SMTP id w22mr903460lfl.185.1580971484884; Wed, 05 Feb 2020 22:44:44 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:44 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon , John McNamara , Marko Kovacevic Date: Thu, 6 Feb 2020 09:44:26 +0300 Message-Id: <20200206064426.45697-8-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 7/7] doc: guide for Windows build using MinGW-w64 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Instructions for different toolchains presented as options on the corresponging steps of the guide, so that common parts may be reused. Signed-off-by: Dmitry Kozlyuk --- doc/guides/windows_gsg/build_dpdk.rst | 65 +++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst index 6711e07e2..6d093d235 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,15 @@ 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. + + Install the Build System ------------------------ @@ -43,6 +59,14 @@ 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 +.. warning:: + + Meson 0.53 has `issue #6431 `_ + that prevents cross-compilation and another linker issue with Clang + (`workaround patch `_). + Meson 0.47.1 is recommended, Meson 0.52 can also be used if new features + are required. + Install the Backend ------------------- @@ -56,23 +80,41 @@ 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 + +Option 2. Cross-Compile with MinGW-w64 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The cross-file option must be specified for Meson. +Depending on the distribution, paths in this file may need adjustments. + +.. code-block:: console + + meson --cross-file config/x86/meson_mingw.txt -Dexamples=helloworld build + ninja -C build + Run the helloworld example ========================== @@ -87,3 +129,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).