From patchwork Tue Feb 18 00:02: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: 65851 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 838E1A0554; Tue, 18 Feb 2020 01:02:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A3C091DA84; Tue, 18 Feb 2020 01:02:40 +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 BB26B1D989 for ; Tue, 18 Feb 2020 01:02:37 +0100 (CET) Received: by mail-lj1-f195.google.com with SMTP id x7so20801884ljc.1 for ; Mon, 17 Feb 2020 16:02:37 -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=umLQecGVt8EO5YK5gxsZYBqxfTNmrrw4MfD6KiCbGlU=; b=Yuijm3xwoyiqkcMtNN859knG0rQlR3+T8kDlYlRtdSKMkLbt2E5fIlQ7KVAlBQUQM5 VNhJHCHZk+O9L5wbRg57A3cCgFXondL+W1h4E1GxzjgTLvbZeNXpjyOG4uPMEmng0kkt TzaMebOdejexvCoAFvgA+MBxUAYoBeTrwY7sufiGfzdvfJSfENfAdRtL98yJwSXCz8ck ESiFr7JnUxvL2aEutkvHUPLyFQT+0MlnnSKUumMZuPTDrr5SlS4QQNABY9WDbp87Lnxz zvV0DKxUmBggN7aggg91rMpY8qsubEKH1xgakZV2kOeP+GE7HvoHOrAKYmmkf4ZJ0S0p csCA== 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=umLQecGVt8EO5YK5gxsZYBqxfTNmrrw4MfD6KiCbGlU=; b=qAOsVbV4CPxQLFUpv9XdxdmkgaIIRmQSKmU7LvojuSKngrqgddV53yjNfVZeAk9l9j E8G6V/4R/MyePBB8mOoG2idZiz2kZ9mcmgG9JK5xCDp7jAouyN0R3fOTd1J5rET9pv2o E6eE+d3otMxCBIvU31fYb16ePF63z15mtSp6CRyNDdUWfeJe2sroigH8qWvsci68AMiP mY5aMMMbj/sAs1C16bUGG/bLsMnyTDwvXYkcdmKxrqqypRgNGz6cf0NuLWun4VZ3avYA S/6hbyALSsbr61PhL4uxgyTnyuckXeCuc/PjAS5fNvJpSnCnHADW3I2T+xteItpbPhg8 aUJQ== X-Gm-Message-State: APjAAAU9u9cq7bkoT4n5S+fkx2JyYDD2XneP8F6W7Sj7shqg0LLw67aT 3DQCYtlaSBsIECtUm0GJtMQDw5VGjS4= X-Google-Smtp-Source: APXvYqxFyV2J3iNY2nJxqzSMCWqJH1AP2ozcBINFuf47o6Afl8084oPY3EvQNyn0qZWTOTeRvnsXhg== X-Received: by 2002:a2e:a361:: with SMTP id i1mr11102714ljn.29.1581984157014; Mon, 17 Feb 2020 16:02:37 -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 r20sm1068864lfi.91.2020.02.17.16.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:36 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Olivier Matz Date: Tue, 18 Feb 2020 03:02:23 +0300 Message-Id: <20200218000229.86621-2-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 Tue Feb 18 00:02: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: 65852 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 54460A0554; Tue, 18 Feb 2020 01:02:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BF261DA8A; Tue, 18 Feb 2020 01:02:42 +0100 (CET) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id 009F11DA7E for ; Tue, 18 Feb 2020 01:02:38 +0100 (CET) Received: by mail-lj1-f196.google.com with SMTP id w1so20804627ljh.5 for ; Mon, 17 Feb 2020 16:02:38 -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=2mEi4FE2tQgo/qP1M9InxAoEwEU4PiAlaCg/R1jeI5Y=; b=cwdyU3Jzgo7d70NBnCofdELSjBgxAdaC8Zwya5cG0XDNQ6cWYCBSD2SSxjWbWLxo7i 9slLLFiYBptppPZI7y1iuW8ngo/atmsqmVS4QY8sf8aGplRzknwu4q2fUKZpkEF0nIZm 59pY1wEbFg8isi4gO74BLpL6NxsMZSU5OhKEisjOc72ZBEG0aCLPfS1E94okqVr7AZjA 2UyXqkdsuFYObMyVTiDPNxpSetd36aVnf4XAsEtjSVjmwgz+XngolZ4bePBE0dbfPdR8 ISWeQYpqLMNCdcQI1V7S1dwvk64CYt/thtNLp74SDNTdhQl4LOYVTFduaHFTEEi68aYG lSEA== 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=2mEi4FE2tQgo/qP1M9InxAoEwEU4PiAlaCg/R1jeI5Y=; b=MRaYYXL/eQ5cLS3t75eIDouYLXkO3ysRnXojuP3ZXUdgczucR96FR6WWtqzjofEUxH 4qO7VmQjX4HNRxPZqoX4eymlQH9Hio5WkTrc7uJAGb8f0X47/Qiy+l05eFb62XL+FGv2 v2rnXA2SxVAxjU87+nIIEG363gKwlkwYi5cgPv6SUDHpyhiODlSYxV9hYAHm4Ja2xzg6 qzjKi8OwlNBd3krMEhRkpG4Z4ruMxmPQJ/irh2TlG01W9JJ5U+ueQSsmDBp5chr706De wSyXUKOBlB+6CB03OWY8BnLk/mh/MzEPtGm29vMq0zhyROL9FtwPkqWAkH4EDtfXn7BK /eaA== X-Gm-Message-State: APjAAAXAetiZqMQntfIMDT5yGEcJPxzm7o5MxU2F6Z7Rw6Gs7BRkQg9E DeLLs+s0kkwwApmHt0Ub+2fBI6Q2LaI= X-Google-Smtp-Source: APXvYqwSkl77zszLXCr2cp/RZG3aN92hqTPSZlEofFmkv73I8UYyIMtIhqm8hH/+V1oTbT8qcApiJQ== X-Received: by 2002:a2e:721a:: with SMTP id n26mr11268346ljc.128.1581984158167; Mon, 17 Feb 2020 16:02: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 r20sm1068864lfi.91.2020.02.17.16.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:37 -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: Tue, 18 Feb 2020 03:02:24 +0300 Message-Id: <20200218000229.86621-3-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 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 9e762617b..c351f2c84 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 Tue Feb 18 00:02: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: 65853 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 79354A0554; Tue, 18 Feb 2020 01:03:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 195461DA9C; Tue, 18 Feb 2020 01:02:44 +0100 (CET) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by dpdk.org (Postfix) with ESMTP id E43BD1DA83 for ; Tue, 18 Feb 2020 01:02:39 +0100 (CET) Received: by mail-lj1-f169.google.com with SMTP id q8so20790080ljb.2 for ; Mon, 17 Feb 2020 16:02: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=fE5dG7DvNoE4hGY1vfrgNPPk2vGup7bGT8Koksfo3uk=; b=BeQGA2zOIY6auTeEIcWHLo/XFXLvd+G6k+NpOgoRTbK62tyQvbR8S0akkkfQ35AIcM AtmzgrqGOd37Hktl9+rWlhaaGY1es8EA0rHQhW5HCRE2vlFmI/Zs0aZcMMhi0LnELaXp dTyWNBKvmnIv5zm2OMN55We4kl8bFx7q5TgdlQ/PxBA6Qm4sv4zFENW12gejs2Ys6u9l ySwYYSkPfO3esVT2kYIxXUHxlEJizPBx2DOfZS/fcOxz2Oios3y2XTR9+AyNC0UctfSy 8l1bYo/iMXOt91d4wTyGP6Dxo+f4sqdvTA4w7TKPIIzgJ7e6MWID9TAG9QwR6tEcpg9j ZsZg== 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=fE5dG7DvNoE4hGY1vfrgNPPk2vGup7bGT8Koksfo3uk=; b=YFRfSDdhkWyvbV2NsPpVg0gTymIKQU8HI8crTOc2b/rUI+8AuXRaLeT9OYm74cAako Kur0gxgDYP69hn/cFjAV56A1J9N9f5Lpzs6nP0u7soPpgwDshhNIBrHyBmVZlwwSEJIa scD7MIWy9EpkjIKFOi8sbTy9mpcbBuvS1Fyb0CCV6oHJYJf8MHQKmeQHkKkmQ5rh/Z9u 4wnd9YzXtbFJ09tQxFiPbPrMBAx+1L4nLRf5fKaXb8YOODOuKWc+MHQbiuxUGMjWeJr5 6u0Qvw4N+o63466UdtzcTwDZ3jGIro5NDJxpMTaU+rmFDa9DmIvYVZK3LuRt4RYr9F1f OLYw== X-Gm-Message-State: APjAAAVMDAPyrAY0iVQFSmtMYdoIEeEcInRubrtAxgIy+t5LyYda/Km7 +MKqGcmkvDbU8V6RNKHaVulAMzeE8PA= X-Google-Smtp-Source: APXvYqz8npKYFXch8jhgj6SRWE5538wHM+NQ0saqkkXwvTLkHkTn8CCsl0tLkBbvKWeXW3ZPlt682Q== X-Received: by 2002:a2e:814e:: with SMTP id t14mr11357169ljg.149.1581984159261; Mon, 17 Feb 2020 16:02: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 r20sm1068864lfi.91.2020.02.17.16.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:38 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Date: Tue, 18 Feb 2020 03:02:25 +0300 Message-Id: <20200218000229.86621-4-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 c351f2c84..4b9117dc0 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, ...) { @@ -80,6 +81,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 Tue Feb 18 00:02: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: 65854 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 9598CA0555; Tue, 18 Feb 2020 01:03:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9CBA71DAA7; Tue, 18 Feb 2020 01:02:45 +0100 (CET) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 14C6A1DA8A for ; Tue, 18 Feb 2020 01:02:41 +0100 (CET) Received: by mail-lj1-f193.google.com with SMTP id h23so20807761ljc.8 for ; Mon, 17 Feb 2020 16:02: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=m/8P7Xk1Hq53dO3Y7cGgXZBfljzNf4J2Vsqube2++Uo=; b=bIEH2KfPlQXKrGKGbg/oeGY/ca8FYfvV6CxDFW+0BbyxdPxEgsJ4hN6kUSqK7Iri0J AcJTAVpFJ9vDmTSa7FPiDsKhcFF+adGZ9AH4bewjbAQ4J+j0Ht9a4L8V11u248/jJDJA FJ9AOgo5j7bd5W1QYdkdpgvuiIn7dwiVjOPN+Fj7Ytf0LqYuII2JlSXGQfcy7Mxy4M+G 92r5QrMerzumEurEEQ7xeIFbDcWQGF2oaFZmX7LPLXEp8O1EhDzS81RGsouL79MjwELU SKhnASJiXxWyuHspDKjf3qKMA2D4n8z2J7ON+moR4do6KmIFFJjaV/EXclsfrHWhS+ha PTYA== 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=m/8P7Xk1Hq53dO3Y7cGgXZBfljzNf4J2Vsqube2++Uo=; b=b8Uc/93iZ/eS6NoFKezherE6cn6d9NDLlp/XUGfmU4bSjfd2vk2qhtrdzzdz10XKG4 VqAT0GgYdQ5TdssNcCDecxSe4vuH8fJLEnYL5QL1aGBvmYcJdmwY+sHK6Zr4rq7Ns6tJ lY0NUxrfPpOPytJBFFpjAgJ3uOLeUm8/CGMlxHo2Li4ubs8QxNt9Q3WkpDsos1OGhRha E6VS8Od5/ee9V4kTSw2UQvRQRMwQJ90RaPOT5s9d1CQydHVdvoayb6x1xE1JbyfJm98+ cjW/zOddwhCxkVfCfoMijuJ7X094hVTeRSLSIAhDSWgrEZvdH+qEZfKaO6b6KpGw0xDu 3v2g== X-Gm-Message-State: APjAAAUYDrb2V1YSLbhbgUGdB9PcBHKVCieEwk/2sq+mdHRzV7bRHGwm hQ8QxcbDDtmcSmK9oAC2oqVCKxIPB1w= X-Google-Smtp-Source: APXvYqzoaX2CXXKDyAWKq7ONOE4i8UJt5g+2Gr1aHdooo8qRLpWVTb5wnY53pfijJo2WATp9NX5BJA== X-Received: by 2002:a2e:8e2a:: with SMTP id r10mr10705476ljk.219.1581984160272; Mon, 17 Feb 2020 16:02: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 r20sm1068864lfi.91.2020.02.17.16.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:39 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Tue, 18 Feb 2020 03:02:26 +0300 Message-Id: <20200218000229.86621-5-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 6c46767e3..61eeec0de 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('.') @@ -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 Tue Feb 18 00:02:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65855 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 4CDD8A0554; Tue, 18 Feb 2020 01:03:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 19C681DAB3; Tue, 18 Feb 2020 01:02:47 +0100 (CET) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id CE08A1DA8A for ; Tue, 18 Feb 2020 01:02:41 +0100 (CET) Received: by mail-lj1-f196.google.com with SMTP id q23so4712594ljm.4 for ; Mon, 17 Feb 2020 16:02: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=7eC31oXTZFs91lh/XF0hZDISHGXBX6Qg6HrhwXjOkV4=; b=RwKONynaeUaCXBU5muGugMm7ZbQDukgb7ntGGPakTW1Iav3MeFDh+GsRQBE5oReSOh N2Qmra+nZMAxPVxSR6iw33MJOdmeY/5sgHvtc+5G3nrZUQXqTgsuH43PcaBEFArOun4j ddFXIVEflaIhQ7cEngc7BqDQAmQCH6e3olcRK4sFgMeyi/unyM1L3IAFMQZo/f6nvR47 ZQdQ52Mf9LCi8Cp/0bhY2NyAD3UkgdWj2Q7GuPdKzA6IL2vAMYtNnDpDqTolfObCXPdP hFuoWmZhpAM7VocEk+zV9ubAhVyp+3MK+Fu2f9b11IULgYkK+2FJ2N9bK2rApusYtF1s Ouxw== 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=bp3tR0BDZUKafMDJY5LS8yRUszirFozoDiURTLL6osTgGorWmUm/Hy3nj85KPxBoRP NwaA4sZrVK+KraEWowENYG2ENPnIWQ3nnCS7Iuf5iBCMR0E/Xiq8HQnoTS6y/aPGOL8s uLXcBs931DZi+aDQMjQrH8LrScEv0QWhSXSi8iOokjzckk2k46rSGX80vKHq34DLslfB AT3kkbnpduEgMqInn0i2o1XtUfEmjS1GOBp9fg8RQIdlYt5FWARL6w4o/6JoB8u+dpXT +triHj8MJZMW2e+GasF+5awVWZo6rUzp51MmmuqGvbpI3pnPqLDuwJ3SBI9AinmrgbDK nBRA== X-Gm-Message-State: APjAAAXdoslfWnTSrjc1EJACkIBK7TzSvAlcihXiVVkDB6bL+X6m6Mpa +ad3FlgvBGDu6GJx+T+9EOPEtWKnMyI= X-Google-Smtp-Source: APXvYqzfnIb4LJ+OhtaxViz462j4S34emNydUzTV7m+almlWOb4S9NghlDlDI+rHmbN5XwW1p3f4Jw== X-Received: by 2002:a2e:97cc:: with SMTP id m12mr10993607ljj.241.1581984161206; Mon, 17 Feb 2020 16:02: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 r20sm1068864lfi.91.2020.02.17.16.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:40 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Tue, 18 Feb 2020 03:02:27 +0300 Message-Id: <20200218000229.86621-6-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 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 Tue Feb 18 00:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65856 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 D274FA0554; Tue, 18 Feb 2020 01:03:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 84E941DA83; Tue, 18 Feb 2020 01:02:48 +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 E92861DA92 for ; Tue, 18 Feb 2020 01:02:42 +0100 (CET) Received: by mail-lj1-f195.google.com with SMTP id a13so20805161ljm.10 for ; Mon, 17 Feb 2020 16:02: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=KqRrEqJRFRftz8s0057ej5A0HfY0B+hLlC0CZAouhbw=; b=SvuwuRgA5yA4SN9UOlYsWRiJ4kRocus6vYbA0u2Tga/qXFtjwA8bS1UPMeyjRK1KX+ dcarxRDbdUQqN+4kB4sZ29SxRgCiuJgfD7XnM8+jCK+cF7WK7H/eHSPbItBU3V1rgWdC uX0JjU9s7HjGwCl1xtHvupn4kjLh4xuzRhr5ktsFg3m+JJ0+tJ1cJsRfupifvJezhQ2L SoycFeU50zK+PXht4aF1hoHEOqd/pN5Sq++Np8+K0yaQhEmiReg+dLG+Y6qmUm4yBDWC fDuQk5CabtWjRMrPiHkTPaR+Qkxn3jdrie1qnSMcb2YEaYPveIjfnqdAB+IpPNpnPPuH 3cuQ== 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=KqRrEqJRFRftz8s0057ej5A0HfY0B+hLlC0CZAouhbw=; b=ljm5jxNvz5N+I/hx3lW+o7Wm3x/fvZyOiK1vA4BTKyqMYI4u4ZC2El41hu/0bYAGed KtZtoFVhQIPQF+5OIr5L9itcB5bXhUo5kDfxS/t9yieuMdfrOaJX1JGBPqbztYR2N0Zs ZVNHTXQpn0vqJDike1HGfe3ut17g0jrzbDkw/JcxsFgU5qIL0lRG5PzLjDjWSfMB+ib4 jnH8K47q8nEqpVs4DDdGax8D2t0lXZi/6ty69JU9ngyenWMNKRvlsTD9cvIo8iyuzwu0 HcDoTJLG6Z7KlRPlwC6NmpdurWf5i9osaXHkPiE1zyBcW6Rl8KNgHLkD2AvgRi2SP+OH KVkQ== X-Gm-Message-State: APjAAAWCV4M6NrcRX8kXDUgIN15EvIOT/b5g3iiQYW0fM7an1uuXnl5u YKZgQFufu08eFhcUeJ0q9B0Umb73HC4= X-Google-Smtp-Source: APXvYqyCQt5DUFFHRxp6r+12tGVRHcoyYRtkBu4Ry3IzCqTw/A5bPVGEfi0s9fRXZhms5xhNpP14AA== X-Received: by 2002:a2e:8e63:: with SMTP id t3mr11187091ljk.239.1581984162229; Mon, 17 Feb 2020 16:02:42 -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 r20sm1068864lfi.91.2020.02.17.16.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:41 -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: Tue, 18 Feb 2020 03:02:28 +0300 Message-Id: <20200218000229.86621-7-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 63 +++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst index 6711e07e2..c77384785 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,12 @@ 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.47.1 is recommended, Meson 0.52 is the latest version known + to build DPDK successfully. Meson 0.53 has fatal issues with Clang + that prevent both native and cross-compilation. + Install the Backend ------------------- @@ -56,23 +78,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 +127,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 Tue Feb 18 00:02:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 65857 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 0C5FEA0554; Tue, 18 Feb 2020 01:03:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C89481DABD; Tue, 18 Feb 2020 01:02:49 +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 D8AA31DAA1 for ; Tue, 18 Feb 2020 01:02:44 +0100 (CET) Received: by mail-lf1-f65.google.com with SMTP id 203so13079412lfa.12 for ; Mon, 17 Feb 2020 16:02: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=s3wMNnRsGpaNal+DEvRhr3WOzzZBhd0oeaMLom14dKA=; b=F0Zi5yZRUxR9skGIkCUlaOv3pN2ZmKtc13xp6bTEbI0qbwQsCdl6aGYayWVwDQh3JW YAAi0g+W7+cVJWTOEQk3ZfiIJzWEYwF8aRKVq8hLGlbbs3uXjw7w45w0ULWwRXgONE8h bnNT9ULhZFd6H0ZaypOkQKMEieJdwfnrAXjfAq0fxn3FPJ+7g8j2WYxRNyOFpUGfaa9m cRcbTQTuZvNhm8BXlja9uNwd3O0D9CyjczX9fxyor2N/eD7xbqktQtyJTbed33M5iiTZ SGQ3gBTB1JdLt2rzWhmIJY6uiAVRsWGDk4rDVnOXt2YT6dg6gEBLZvqZ8U87EZhqDOlU K8Og== 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=s3wMNnRsGpaNal+DEvRhr3WOzzZBhd0oeaMLom14dKA=; b=WPRTsKJBW5QCv2GU9FyNgp9oFeahd0RxrDx6Iz7l4AYajbg9QpQxLtXy0v3CuSdKtS jK2ITIXRq7W3N/8s7q152r4+P21XDdP6kAasEEry28BWvrzdpXYtckbVS1B3dlfMfkho QN2+gBaTSR6m5eZPogH/PHeeWyN6D98z6l26aW+c84DQyXlDwCjUU0H/5JmAU2Ink54e +la833P1AE3t6ntiKdsD3T3v4qY1bjizRIEA24RnNMFadSkXwefVHdOIUYd33WuIjOd/ 2oy9j0h1glKy7wIoV5SsE20U5dcw3AxdgR3hMf0fijBCzhFrYSI4n4wzAfpbyzpfzz03 i0Dg== X-Gm-Message-State: APjAAAXFGAMxwbtkPHIuhCdTLRdTD+JzYQqCmQES3N5w7+f7l43uUey9 xDGsOytNOgT67V4+kqaHxjrXqKgTZVc= X-Google-Smtp-Source: APXvYqxS8Npx0M3vBXjzICydtxf0iAN+f+tjfVnKc3un3ljU4Rri5/t83+u8MUohBHRtYR8qnRm2ww== X-Received: by 2002:ac2:52a2:: with SMTP id r2mr8997709lfm.33.1581984163140; Mon, 17 Feb 2020 16:02: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 r20sm1068864lfi.91.2020.02.17.16.02.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:42 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Tue, 18 Feb 2020 03:02:29 +0300 Message-Id: <20200218000229.86621-8-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 61eeec0de..69e53e41d 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()