DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nick Connolly <nick.connolly@mayadata.io>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
	Dmitry Malloy <dmitrym@microsoft.com>,
	Pallavi Kadam <pallavi.kadam@intel.com>,
	Keith Wiles <keith.wiles@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Ranjit Menon <ranjit.menon@intel.com>
Cc: dev@dpdk.org, David Marchand <david.marchand@redhat.com>,
	Nick Connolly <nick.connolly@mayadata.io>,
Subject: [dpdk-dev] [PATCH] windows: build error with mingw debug
Date: Fri, 27 Nov 2020 11:07:26 +0000	[thread overview]
Message-ID: <20201127110726.5328-1-nick.connolly@mayadata.io> (raw)

Compiling with MinGW in --buildtype=debug produces a redefinition
error for strncasecmp.

The root cause is that rte_os.h shouldn't be injecting POSIX definitions
into the environment.  It is the applications responsibility to decide
how to handle missing functionality.

Resolving this properly will require further work, but in the meantime
wrap all such definitions with #ifndef/#endif.  This resolves the specific
issue with strncasecmp and handles similar issues that applications may

Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
Cc: stable@dpdk.org

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
 lib/librte_eal/windows/include/rte_os.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 569ed92d5..ea3fe60e5 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -25,22 +25,42 @@ extern "C" {
+#ifndef sleep
 #define sleep(x) Sleep(1000 * (x))
+#ifndef strerror_r
 #define strerror_r(a, b, c) strerror_s(b, c, a)
+#ifndef strdup
 /* strdup is deprecated in Microsoft libc and _strdup is preferred */
 #define strdup(str) _strdup(str)
+#ifndef strtok_r
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+#ifndef index
 #define index(a, b)     strchr(a, b)
+#ifndef rindex
 #define rindex(a, b)    strrchr(a, b)
+#ifndef strncasecmp
 #define strncasecmp(s1, s2, count)        _strnicmp(s1, s2, count)
+#ifndef close
 #define close _close
+#ifndef unlink
 #define unlink _unlink
 /* cpu_set macros implementation */
 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
@@ -89,7 +109,9 @@ eal_strerror(int code)
 	return buffer;
+#ifndef strerror
 #define strerror eal_strerror
 #endif /* RTE_TOOLCHAIN_GCC */

             reply	other threads:[~2020-11-27 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27 11:07 Nick Connolly [this message]
2020-12-07 18:30 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201127110726.5328-1-nick.connolly@mayadata.io \
    --to=nick.connolly@mayadata.io \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=dmitrym@microsoft.com \
    --cc=keith.wiles@intel.com \
    --cc=navasile@linux.microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=stable@dpdk.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).