From patchwork Thu Feb 27 04:25:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66061 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 EA94EA055A; Thu, 27 Feb 2020 05:25:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 127391BFC8; Thu, 27 Feb 2020 05:25:52 +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 37E1C1BF8D for ; Thu, 27 Feb 2020 05:25:50 +0100 (CET) Received: by mail-lf1-f68.google.com with SMTP id r14so1009959lfm.5 for ; Wed, 26 Feb 2020 20:25:50 -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=XwxpU67dFdFosV05TbGYMhklbSndu2oWkeA7Knzj6iE=; b=Yhyd88dpnVfL6/MR8BTcqmrjtWlmE2CwsnQ+JaCx/bCMzqxaff7oXVk5JA236Fjzje X8GQci0RCSWlmj/b6zSftWWsp4EbbJJzDH9XCXmSIhjEhdaDlxR133DZott/rFfkZ1NH oM8opCYm2tImBNPaulAq8EhxjBJMAxVatdTyL+MuRsp0m1V0PSUYtiMfuPwQhc5uMRbS pigGs5qye5J1twoV3oA6dOCMi18FPu0jqJbJNiLzAtc5fcp/jwQ9BwS/idkz8Gm24/a+ bU38to4jnPVpmemi+C0ciulSV3iALa7hCWTV4HVfMTZjm+XKxP6kRztkLfCFAjsZhy2Y NGTA== 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=XwxpU67dFdFosV05TbGYMhklbSndu2oWkeA7Knzj6iE=; b=Pc01V9cs+K5E5OoI5/+0oV9qKX1DYp28MbmfxjlrHWcMLeBWD0cXUOaZglmbB1EQtJ f6D/Xc+0vHnY2xsDLNas84dJPnp23KIPt7Z8E1YiGoNam2nR8YCySfV/eXLTIgwqWX54 zJ3xfnPEH37NC8kw9sOytFwrl2XjsxJi9zgCR3AsPIa4Mu18CVJwfL7QBd5LDL2sqBP5 7HS5wRFgjsK/5Xfe/TrGips02G2yazPyybd1ME8bEPbF6ZP6MqWOcUnEZLGIXHV0+ShN XgeP0D/vnyP807Nuxw9bczqaixGoDGEEVttEVU4Ma317dlL/MJMv/NQXrp41od0mYaNy qLMg== X-Gm-Message-State: ANhLgQ3CtqPJ5qQ+Ag5D1kMROG81vkl/ri+HGeIlkpkb6DWLbe58c3eB kt30V6LVcQ3SFa5KHGzzccOZ2TNUK/U= X-Google-Smtp-Source: ADFU+vv43BFK1UoHobUV0o4zt5jD5elg0ThcGzgNWWIFekmng4bX3UTNwEkjr78MWkGQQ2rRqtsWjA== X-Received: by 2002:a19:dcd:: with SMTP id 196mr1036709lfn.199.1582777549287; Wed, 26 Feb 2020 20:25:49 -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 g21sm2224350ljj.53.2020.02.26.20.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:48 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Olivier Matz Date: Thu, 27 Feb 2020 07:25:31 +0300 Message-Id: <20200227042537.187459-2-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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. Use this new attribute for logging and panic messages in EAL and for output strings in cmdline library. Signed-off-by: Dmitry Kozlyuk --- lib/librte_cmdline/cmdline.h | 4 +++- lib/librte_eal/common/include/rte_common.h | 17 ++++++++++++++++- 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 ++-- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h index 27d2effdf..243f99d20 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); diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 4b5f3a31f..226c1a011 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_printf(format_index, first_arg) \ + __attribute__((format(gnu_printf, format_index, first_arg))) +#else +#define __rte_format_printf(format_index, first_arg) \ + __attribute__((format(printf, format_index, first_arg))) +#endif + #define RTE_PRIORITY_LOG 101 #define RTE_PRIORITY_BUS 110 #define RTE_PRIORITY_CLASS 120 @@ -784,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..7edd4b89c 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..898efa0d6 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..a0d1f4837 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 27 04:25:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66062 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 DAC14A055A; Thu, 27 Feb 2020 05:26:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 62F851BFD3; Thu, 27 Feb 2020 05:25:53 +0100 (CET) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by dpdk.org (Postfix) with ESMTP id 1C4B11BFB3 for ; Thu, 27 Feb 2020 05:25:51 +0100 (CET) Received: by mail-lf1-f52.google.com with SMTP id z9so1022158lfa.2 for ; Wed, 26 Feb 2020 20:25:51 -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=yBqVZ8DtI8eVaDbhfrWnsFLO5z1alRz9iLMs1D8LYVA=; b=ivgdodGSXixJ+B7GbNWNKP7MgGOZRtxP5ebOziLO07ycvWUWsOrN6LSHu3L6k8gCGm LemFUFq3Wj8FzO0M6waljul/qwf+CkSGLZH91FnXZZ4KaS0s8TXDe6SJaRWHQNHxljrE y4cmD1B071r4sdYYKmoRJH59D3a6Bt+ZJb0vIwR6uSDLsanOKAChQMa3R34hn7SwsrNH lswftXQE5CR5uU9Og1tWl+Dmzwg1xe6JBpEHpnnRQ3Mlpl+P8DtGXX0wcIFWkolRmRb5 GjKdKMrGXC+U4roQr5SP5Qm5mzA9S6/eZrEd3mA3C9o+tU/W4HmNmfVdda8GiVHg2M7f M1oA== 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=yBqVZ8DtI8eVaDbhfrWnsFLO5z1alRz9iLMs1D8LYVA=; b=uE7LH7og5pfLiRy8Ne30KJDBOopwgEFrKwpuILoP1Q4vzOMjlqIft1la/lFBeB9rLN TEiBsMExRyd7k0LncNywxRXol22b3+DQmgWDVvSVKcAUrp+sEV6oy410nhD3+26SrQXf XFoXi6pY8lzLjz7oB64xvJIqBfuoWxoRKZXJMnOpbPu9b/UvrzCed9N4OT7ATaxUiodh OA0BEJOu+7pfQRYB7olsbp2kSbhho4nL7On9dVMQKwpZ+OfW1dmHazCNV+I6wxol8h4z 0XekZcvfYBTk5JmQDjU2YHctX+jo81evOem6PDJKTJarI8BgIRBFB3cXQAybJtRYq4JO Zi1g== X-Gm-Message-State: ANhLgQ1BTYfZGo2HP1uJqj7hXmRFGo29EMQupVIGenjAB/JYGk0ZJ4fG Kqamt1Gca20H2S9GIdmZakd0Pfhm+bQ= X-Google-Smtp-Source: ADFU+vsA77Pt3NAQZ18X7J2V1UNcjTqQAR/tEcH6omoepfDlJH/FwicNmkhXcib5Ukq2eA9ji7i4DA== X-Received: by 2002:a19:8b09:: with SMTP id n9mr1046033lfd.7.1582777550385; Wed, 26 Feb 2020 20:25:50 -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 g21sm2224350ljj.53.2020.02.26.20.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:49 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Narcisa Ana Maria Vasile , William Tu , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Date: Thu, 27 Feb 2020 07:25:32 +0300 Message-Id: <20200227042537.187459-3-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 2/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 Reported-by: William Tu Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/windows/eal/include/pthread.h | 2 +- lib/librte_eal/windows/eal/include/rte_os.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h index 4ac24de0a..b9dd18e56 100644 --- a/lib/librte_eal/windows/eal/include/pthread.h +++ b/lib/librte_eal/windows/eal/include/pthread.h @@ -14,7 +14,7 @@ extern "C" { #endif -#include +#include #define PTHREAD_BARRIER_SERIAL_THREAD TRUE diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h index c76be1216..95a19b2d3 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 #include From patchwork Thu Feb 27 04:25:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66063 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 C3318A055A; Thu, 27 Feb 2020 05:26:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E65B41BFE3; Thu, 27 Feb 2020 05:25:56 +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 6004C1BFCE for ; Thu, 27 Feb 2020 05:25:52 +0100 (CET) Received: by mail-lj1-f173.google.com with SMTP id w1so1735597ljh.5 for ; Wed, 26 Feb 2020 20:25:52 -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=YCncJPpdWauGQHZNRnP6rzv3Jk6/0Oc5J2HhSRu9zds=; b=SId1KconwfVXHk96vYHIgyC/hRiU9o5Mgtl+B8QxrAkPtVeO/M5MfXOUwCXxLbXRaT GsHnW68Zg2gQk36uk3sdEURLaWdOYG0kCKhhH9WF3y8uamXTKbxXONZ/KuguOzOUmav8 kidKBg+h8jbgLd613oHa9jzLmYJcO9m/vepOH/R1+j5bUktcpOnTpHxKiGAKPWVyBTYn EMs1fOvg0ViIYOyQ4vMF/3dr1n+x4PNl90+AiWv1IZQedzwK7wJaybTlPbIfMM+iaxkV o2wQV1EauzgyyG3xwLpnsx50k143P1wN70qg1tPxwpNfdHP4/vh4GoOcPVawgIhghNX1 RKkQ== 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=YCncJPpdWauGQHZNRnP6rzv3Jk6/0Oc5J2HhSRu9zds=; b=cllZrrlGZhvS9jPaZCj4kTDeXzoeZppDvaAUiDRRgvIfbP+fgt5eFsKJaDfPeT/FPY zGPxDmJylea5pUsujs8AThTkbu1McCxhYme7yzhvRdQfrgyVPX4YoVPivEBxwqjDXms1 lc4xAHWd+9Qqvn0hBWlf4ZHP7Q5tY8/ws4A6p6SodSqTMe/PlZ7MMEeXStjN8Lh2uaZe zFNSd3zm6FG+H4wc+bEkrpFB2Yf/bZhghfFfa80gnyxORZ2E3W/WOvlCLbItO30z1HfU VGvQ8F+ee+m5u5igljlyjZmVApUJaAJ0PaQ0vDEJM1iDZFnBJB1djeSVSPkYQ/Au4KLk 7aBw== X-Gm-Message-State: ANhLgQ0DGDOJ0AoTx+I2AHf447y9OrZcVqs2kk1WY58aW2pdOfpmOgDG cyl9th5beCmyEUuBl5mykYToXmTi2qo= X-Google-Smtp-Source: ADFU+vsL/tVGQrvMia50YfZVkQ9hciiadn6U0qJ0dddhFrqTc4byAzMBSEsjKCI9nvLyU/JfGcdKLg== X-Received: by 2002:a2e:b78e:: with SMTP id n14mr1429754ljo.269.1582777551643; Wed, 26 Feb 2020 20:25:51 -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 g21sm2224350ljj.53.2020.02.26.20.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:51 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Date: Thu, 27 Feb 2020 07:25:33 +0300 Message-Id: <20200227042537.187459-4-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 3/7] eal/windows: support builing with 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" Disable bundled getopt implementation and GNU extensions shim when building in GNU environment. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/meson.build | 3 +++ lib/librte_eal/windows/eal/eal.c | 6 ++++-- lib/librte_eal/windows/eal/include/getopt.h | 4 ++++ lib/librte_eal/windows/eal/include/rte_os.h | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index 4be5118ce..1730d603f 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.has_header('getopt.h') + cflags += ['-DHAVE_GETOPT_H', '-DHAVE_GETOPT', '-DHAVE_GETOPT_LONG'] +endif sources = common_sources + env_sources objs = common_objs + env_objs headers = common_headers + env_headers diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c index 34852d42c..e4b50df3b 100644 --- a/lib/librte_eal/windows/eal/eal.c +++ b/lib/librte_eal/windows/eal/eal.c @@ -2,9 +2,11 @@ * Copyright(c) 2019 Intel Corporation */ -#include -#include #include +#include +#include +#include + #include #include #include diff --git a/lib/librte_eal/windows/eal/include/getopt.h b/lib/librte_eal/windows/eal/include/getopt.h index 2eebe54e3..6f57af454 100644 --- a/lib/librte_eal/windows/eal/include/getopt.h +++ b/lib/librte_eal/windows/eal/include/getopt.h @@ -26,7 +26,11 @@ #ifndef NEED_USUAL_GETOPT /* Use system getopt */ +#ifdef RTE_TOOLCHAIN_GCC +#include_next +#else #include +#endif #else /* NEED_USUAL_GETOPT */ diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h index 95a19b2d3..e1e0378e6 100644 --- a/lib/librte_eal/windows/eal/include/rte_os.h +++ b/lib/librte_eal/windows/eal/include/rte_os.h @@ -57,6 +57,7 @@ int eal_thread_create(pthread_t *thread); */ void eal_create_cpu_map(void); +#ifndef RTE_TOOLCHAIN_GCC static inline int asprintf(char **buffer, const char *format, ...) { @@ -83,6 +84,7 @@ asprintf(char **buffer, const char *format, ...) } return ret; } +#endif /* RTE_TOOLCHAIN_GCC */ /* cpu_set macros implementation */ #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2) From patchwork Thu Feb 27 04:25:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66064 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 C2F8FA055A; Thu, 27 Feb 2020 05:26:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4768C1BFE8; Thu, 27 Feb 2020 05:25:58 +0100 (CET) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 71ADD1BFD6 for ; Thu, 27 Feb 2020 05:25:53 +0100 (CET) Received: by mail-lf1-f66.google.com with SMTP id c23so999118lfi.7 for ; Wed, 26 Feb 2020 20:25:53 -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=An531CZfw5v7EAWPyeoYtqp8eSOb3MpKSS0kBWke2Rk=; b=bCjTmGTLEv21ekizwOi0ya+jsyhufOzWNNG62m/edgC1BowS/mF2MpF3MGAyfAitxy 99erb8m869SFiAUqeG69UtNbXwPNSofIL0mfdN+iG5v+nW1amQD/rp2mKgzZ2cS18xSJ ZdFvhIpCIz7b5VyCKxBPy+8tyLbuEUVrpZrDoFjZ5DTYIvZyzL0zBXannvOEnCBoPtyl BCekFu5AM5wXv0I0ucpnxmF3T++BU61WjZf5Nky2Z5oHYxQh7qJLTR/WnLBrRf6CEBZh sROcMy7WjF0yKpEKBU045V+XBUMlHai1odjtBq00lvEQDLl3a8t/7Tbg5TQyJ+rSO0u6 GcsA== 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=An531CZfw5v7EAWPyeoYtqp8eSOb3MpKSS0kBWke2Rk=; b=bA15aCzTiB2w58cLGc07Iob+BnMcW9ZrNgrwj0UyxY5QVxu6Ee3GN/SVGBOBf+TtlM 3gJnM26ERHBWruH93unvk9K8EOaJRLKUH6Uc2EgFMrYfViA8VZwtGJtmCbyWtZjjYPKo xMLo8iQpCcHa/XCRkNZ7/0I+kA0oH1WOuJcrLo4ymyEVrrEmwRCP/nGI8/mSy6rDue1j 702/TBNxDPbzLq11cNDjsTEHqNxE1mG5pL1+Hy5kAsxKjQ5QHQg25QQPhTylrWZPQluf UImiVYsWnFmsDKPsesbC7BzRSFMAfUPkDSdi19ybfbMU91odT5YobNCOi1r9UmU5GjwK dDCg== X-Gm-Message-State: ANhLgQ1XTCAd88sbv0a2qM1Lq1BcLmHUS7ZXum1NBrTXdQnVdWdU5rxW V3RA1FrP/DuHffO6K7JpobltkT0Xin8= X-Google-Smtp-Source: ADFU+vv1+k3/Zum36Xph7+q7i9kaPfEeGaxApojvKP6eAn0LPLEzREREf7yUKNnBlj8yRj7etjr17A== X-Received: by 2002:a05:6512:104a:: with SMTP id c10mr1028198lfb.57.1582777552654; Wed, 26 Feb 2020 20:25:52 -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 g21sm2224350ljj.53.2020.02.26.20.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:52 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Thu, 27 Feb 2020 07:25:34 +0300 Message-Id: <20200227042537.187459-5-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 4/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/meson.build | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config/meson.build b/config/meson.build index d3d2370ce..68aeb8470 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('.') @@ -247,6 +251,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/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 27 04:25:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66065 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 BA941A055A; Thu, 27 Feb 2020 05:26:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AAC4D1BFEE; Thu, 27 Feb 2020 05:25:59 +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 875EC1BFDD for ; Thu, 27 Feb 2020 05:25:54 +0100 (CET) Received: by mail-lj1-f194.google.com with SMTP id w19so1686395lje.13 for ; Wed, 26 Feb 2020 20:25:54 -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=Z5S/q1Liz98Zvuq0zyTouDrDQJbXPcKrnpmMeOeJ/Z8=; b=vdCYvOXupYrrri9Nw1H+bhDjmaPPVUeIPwa6X2uqRqT5uDiE2mTzg6vHuFOqTC9gJL lJnRim6f8Pr+GqdbXBqU4U1wSHSYSH8Orzk88RJ1d2WxS70Zl28xNqBYWxtdZFL3L7zz 9zAkK+SsfuK4SuvX11Sjdi7lDoTB+LaWXncj49xnz1U2yym3hFAWtgMnFLhEoWJHpR/H DBip0qSgp5oQWEJUntIDE7V396HwwLJuVvMsmJ0P3pU/Ky+Aof6fb0wqyC4piMUdVTjZ qyGct487qaJy1/ET1jJwAkQoRgjt2Uk71sOS778ry/qgdaoY/3bc2ApzxNIxvkKaUaNL Otyg== 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=Z5S/q1Liz98Zvuq0zyTouDrDQJbXPcKrnpmMeOeJ/Z8=; b=NPBrzf3kRyE+hHUF4XJ97SXyobqz7sz36db6cbGzfHhSuoXmSWvVwd66Z2w8ecceQh 1kFfrjxM2Dkohg7eEov0GaCHVrEHwxqNjaVDoJkxsFXC4CKGCnsXBIy1Iok7q3nvZLdY QW3tpokRpSzSZaSGfgC7MSGExxB5NxLpUUxbkXC/rdVkYBNlaHE0B5d6YooWT1zhH3If wbjo+BiXKgKWQq5AAHyAW+tSHa+6eY/dicmO/VFLcg5r/3DOVWEwwft3cH+oS9/Gt+0P 2HW3A53kd1nB2EdFqPRjzrGXjI6DPAYC0anZY3DxmryVIy+Tc/nXjWn7In5A0NULwAsh wasQ== X-Gm-Message-State: ANhLgQ142GoMilhCYdxKgT9y6zGXZXr7UJxmMsVMlxI5FlXlVibncW6R 69lWA58+msaZvoW3QAD4s2aL+AbiYqM= X-Google-Smtp-Source: ADFU+vtaDVgz35XCpAXO8UHvZs0puZi9hIjsf3cFDGc7MUar4kEoGEzZyBB88p+FWzz08jzLMoazlw== X-Received: by 2002:a2e:6815:: with SMTP id c21mr1354735lja.10.1582777553839; Wed, 26 Feb 2020 20:25:53 -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 g21sm2224350ljj.53.2020.02.26.20.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:53 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Thu, 27 Feb 2020 07:25:35 +0300 Message-Id: <20200227042537.187459-6-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 5/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 | 13 +++++++++++++ 1 file changed, 13 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..fac33cfcd --- /dev/null +++ b/config/x86/meson_mingw.txt @@ -0,0 +1,13 @@ +[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' +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 27 04:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66066 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 E2838A055A; Thu, 27 Feb 2020 05:26:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2DBAE1BFF3; Thu, 27 Feb 2020 05:26:01 +0100 (CET) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id CD54C1BFDD for ; Thu, 27 Feb 2020 05:25:55 +0100 (CET) Received: by mail-lj1-f195.google.com with SMTP id x7so1759655ljc.1 for ; Wed, 26 Feb 2020 20:25:55 -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=4Nixsc32kpWJ4zJ/2CnlOTuLHD9kQffcjsEkC8b9lXs=; b=N0LyoqrINX8OHBiDKjF8Ruue35aY0A+3tN3yrRpVvIJ1+f426C7lPBKwkolF9+dLdM oo9s6mwtDJ9c+CRwa7G45SuzSTx1hAQcUqG0JlHUje9tPNGIkobj/GgKUdvY8h/lnre/ VCcn9YyvAa4jYdnpP2B38qL2Ja4bdTuUBDxL6yp7ok2sdYixqKd02FLVimRp1rrjhnfx QQJhIx2gcVr9TQijih6cBblG90eh/awAZTjegFB4lgHwm2++JnHzR8JTOeTV2Gvv2UQ0 ODsIgaF7f1SWCO7M9weLdqU0c5nQxsA6iEv1C/BHnsU3JQmmLBhbwYFTg9uDeudRE8q+ 9Q1g== 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=4Nixsc32kpWJ4zJ/2CnlOTuLHD9kQffcjsEkC8b9lXs=; b=i4WpMx3Kit8Ay2aNmsBNGpinqffaK7zq5tbPwy8zOdoVNXQwQp3Lmd0GXz1QE3G9zD Wt+gZfJn3+lqwenLSzCK7jCqOPaqhDVQz4O7K8anyhMksYK2oSMV/uA+y6FgxAmi+ptN Hdy/0rBeEK9QuW//obkwU8DePDnZnQz5YiROqEiHLkeizouBqwjOaIMJ0t4NIomQMt1E DNFBWtOU15BTxV6dFHM4vapp3WArs7sP9vVdWtJC9ktoe6N1EMDGCJFEnTBt6Fs0c3Ct J879bFGj6DjsZ7nFsQPF+C2F5aOsFRkXwkEsndumc8aJp6u6FJ/tq6NWjfT9/00G85mO 2iQw== X-Gm-Message-State: ANhLgQ3sig0F2LfM3lONkkrLkJM2GIJdbY71Bl2GPS6SsnmVYIAHYRzt b1uUUsVUKCG1QqGA7iDEu4l9+wh2vZQ= X-Google-Smtp-Source: ADFU+vsLwAIgsSf3EeTV/U46wTOcRT2d/bn2WBMiK4AmUw43nzxu7T+21q7hDI1tkmpqBUMXaIZMbg== X-Received: by 2002:a2e:909a:: with SMTP id l26mr1355245ljg.209.1582777554993; Wed, 26 Feb 2020 20:25:54 -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 g21sm2224350ljj.53.2020.02.26.20.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:54 -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, 27 Feb 2020 07:25:36 +0300 Message-Id: <20200227042537.187459-7-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 6/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 | 62 +++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst index 6711e07e2..d46e84e3f 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,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 +126,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). From patchwork Thu Feb 27 04:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 66067 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 EFB90A055A; Thu, 27 Feb 2020 05:26:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0915A1BFFC; Thu, 27 Feb 2020 05:26:04 +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 C01DD1BFE1 for ; Thu, 27 Feb 2020 05:25:56 +0100 (CET) Received: by mail-lf1-f67.google.com with SMTP id n25so1030265lfl.0 for ; Wed, 26 Feb 2020 20:25:56 -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=4XnHnvFEwZRBcq06sml3mLo5vH7FoLwcoxI9OcsVhyc=; b=F223Q53ksThavVeCfqw9RDAdn+COetNrTrBD9oKgttDC9UCOkitchUY/HLTb/NR0Uk zxcX/pQEQ+SpkBKI3xfHwxEbFG2idGwnV7g/MS+GGyYgdL6ba586JKgxK3xMYHCas2u2 eEbJcyvdeOP7swH9H99YHUoLhzxwM61FBmVB86ME6NNiK/JBB84suoRNNa/3XIEuDa0u SkFbeUCC5/oZkK9kHGd+vvv8JtAq1vr70HaNqyXDs1q0JUNAZboJCYiySF3brNXjTvhv JI3W3TT9/XTP6wg/qGqIWAgj3kZXhzaGii7pMBLFnQzMp/Iv4EmDrbguCek9HkbjwM3q DKFQ== 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=4XnHnvFEwZRBcq06sml3mLo5vH7FoLwcoxI9OcsVhyc=; b=OoODq0CSI+CedvcFfCCk2Dxk4h5nHxHuTIyx7gmK0C33lEJ7u7E4w/KXoIWXgpUigb CfA7xBI8WqDJOOAHejRpky4025kg3Vumn8u/XWpyHYxme/JCgRxk6BJWfGcPqt9NpLbB 5fukJZtflw8mwdkbQufdoygqMo6BZfB8lnDRogHSEfLM7TXRpZqPr7IPcglw0vZsgIsW ZPh/HXuiuQMQrhs0Sj2qAvh56migXUFpajNDwZ/R5BeT9m3kZbKi7Z4NyUGFARb/y6ec 5P5zTfgCCN0bLgYWNaX7bY2tYslidiUwlEaBtWgOI+d5HE1zLpKApvaoXQWeoVObFcQE j0JA== X-Gm-Message-State: ANhLgQ28rosPr0zMpJ9kW08zImyW1/sa6RucD7+P45s0xEXr/DUcWyC+ VFIaVJV7lZOisbGhL2FfSzWmccgT1Ag= X-Google-Smtp-Source: ADFU+vuaBK073t+7K890/rmbXV/HIP+mjkLYVDyxBoH2dj6Y2NVZiJ0ZEPRf4dmTDOjcvCUiQ6GIHg== X-Received: by 2002:a19:ca15:: with SMTP id a21mr1003489lfg.67.1582777556013; Wed, 26 Feb 2020 20:25:56 -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 g21sm2224350ljj.53.2020.02.26.20.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:55 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon , Jeff Shaw , Pallavi Kadam , Ranjit Menon , Harini Ramakrishnan , Anand Rawat Date: Thu, 27 Feb 2020 07:25:37 +0300 Message-Id: <20200227042537.187459-8-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 7/7] build: fix linker warnings with Clang on Windows 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" Clang on Windows doesn't use pthread for now, while MinGW does. Removing `-pthread` option with MS linker fixes the following warning: clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument] Option `--no-as-needed` is meaningless for PE output. Disabling it on Windows fixes the following warning: LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored Fixes: 98edcbb5a ("eal/windows: introduce Windows support") Signed-off-by: Dmitry Kozlyuk --- config/meson.build | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/config/meson.build b/config/meson.build index 68aeb8470..abedd76f2 100644 --- a/config/meson.build +++ b/config/meson.build @@ -112,11 +112,15 @@ dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1) dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8) -add_project_link_arguments('-Wl,--no-as-needed', language: 'c') +if not is_windows + add_project_link_arguments('-Wl,--no-as-needed', language: 'c') +endif -# use pthreads -add_project_link_arguments('-pthread', language: 'c') -dpdk_extra_ldflags += '-pthread' +# use pthreads if available for the platform +if not is_ms_linker + add_project_link_arguments('-pthread', language: 'c') + dpdk_extra_ldflags += '-pthread' +endif # on some OS, maths functions are in a separate library if cc.find_library('m', required : false).found()