https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70311
Bug ID: 70311 Summary: libgfortran build dies on "implicit declaration of function strncasecmp" Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: keith.marshall at mailinator dot com Target Milestone: --- I've just succeeded in building GCC-5.3.0 as a GNU/Linux hosted cross-compiler for the mingw32 target. However, I did need to add: #include <strings.h> to each of the following libgfortran source files: libgfortran/intrinsics/selected_char_kind.c libgfortran/runtime/environ.c libgfortran/runtime/string.c This is required, because the prototype for the POSIX.1 strncasecmp() function is correctly declared in <strings.h>, which these three libgfortran sources do not include; (they do include <string.h>, but that's a distinct header, with a different, ISO-C conforming purpose; in a strictly conforming POSIX.1 context, it does not declare strncasecmp(), and recent changes to the MinGW.org runtime headers have introduced this conformity requirement). In addition, I ran into an issue surrounding the implementation of the strnlen() function ... again an implicit declaration issue. For the mingw32 target, this issue is less clearly defined: the function is available on hosts from Windows-Vista onwards, (and the GCC configure script may detect it), but the prototype is not exposed in the headers for a default mingw32 build, (since the default aims to support earlier Windows versions). My work-around was: -#ifndef HAVE_STRNLEN +#if ! defined HAVE_STRNLEN || (defined _WIN32 && ! defined __CYGWIN__) so selecting the local replacement function in libgfortran/runtime/string.c; this may be a prudent configuration choice for _WIN32 in any case, since the build-time detection of strnlen(), may become invalid at run-time.