public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: gdb-patches@sourceware.org
Subject: MinGW compilation errors due to strcasecmp
Date: Sun, 09 Oct 2016 11:20:00 -0000	[thread overview]
Message-ID: <83oa2tg459.fsf@gnu.org> (raw)

I've upgraded to the latest mingw.org's MinGW runtime lately, and that
triggers compilation errors building GDB 7.12:

     g++ -O2 -gdwarf-4 -g3    -I. -I. -I./common -I./config  -DLOCALEDIR="\"d:/usr/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/..   -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber   -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1   -Id:/usr/include -Id:/usr/include/guile/2.0  -Id:/usr/Python26/include -Id:/usr/Python26/include -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wno-format  -c -o windows-nat.o -MT windows-nat.o -MMD -MP  -MF .deps/windows-nat.Tpo windows-nat.c
     windows-nat.c: In function 'so_list* windows_make_so(const char*, LPVOID)':
     windows-nat.c:608:35: error: 'strcasecmp' was not declared in this scope
	if (strcasecmp (buf, "ntdll.dll") == 0)
					^
     windows-nat.c: In function 'int envvar_cmp(const void*, const void*)':
     windows-nat.c:2031:28: error: 'strcasecmp' was not declared in this scope
	return strcasecmp (*p, *q);
				 ^
     Makefile:1134: recipe for target `windows-nat.o' failed
     make[2]: *** [windows-nat.o] Error 1

A similar error happens in stap-probe.c.

The reason for this is that MinGW runtime changed the place where the
prototypes of strcasecmp and strncasecmp are declared: they are now in
strings.h (which AFAIU is more compatible to other systems).  But we
don't include strings.h anywhere, although the configure script probes
for it.  I guess other platforms include that header indirectly
somehow.

My suggestion is to include it in common-defs.h, as shown below.

Is it okay to push such a change to the repository (with a suitable
ChangeLog entry, of course)?

--- ./gdb/common/common-defs.h~0	2016-10-07 20:09:21.000000000 +0300
+++ ./gdb/common/common-defs.h	2016-10-09 12:30:04.178750000 +0300
@@ -49,6 +50,9 @@
 #include <stdint.h>
 
 #include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>	/* for strcasecmp and strncasecmp */
+#endif
 #include <errno.h>
 #include <alloca.h>
 

             reply	other threads:[~2016-10-09 11:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-09 11:20 Eli Zaretskii [this message]
2016-10-12 17:46 ` Pedro Alves
2016-10-14  7:15   ` Eli Zaretskii
2016-10-28 18:40     ` Joel Brobecker
2016-10-29  8:07       ` Eli Zaretskii
2016-10-31 12:34         ` Joel Brobecker
2016-10-31 16:40           ` Eli Zaretskii
2016-11-19 18:25             ` Joel Brobecker
2016-11-19 18:38               ` Eli Zaretskii

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=83oa2tg459.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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 read-only IMAP folder(s) and NNTP newsgroup(s).