Bug 20753 - MinGW compilation errors due to strcasecmp
Summary: MinGW compilation errors due to strcasecmp
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 7.12
: P2 minor
Target Milestone: 7.12.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-31 16:32 IST by Eli Zaretskii
Modified: 2016-10-31 16:38 IST (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eli Zaretskii 2016-10-31 16:32:00 IST
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 -Ibuildgnulib/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-signcompare -Wno-write-strings -Wno-narrowing -Wno-format  -c -o windows-nat.o -MT windows-nat.o -MMD -MP  -MF .deps/windows-nat.Tpo windowsnat.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.
Comment 1 Eli Zaretskii 2016-10-31 16:33:02 IST
Fixed in GDB 7.12.1.
Comment 2 Eli Zaretskii 2016-10-31 16:34:47 IST
The patch was approved in 
https://sourceware.org/ml/gdb-patches/2016-10/msg00329.html