Subject: bug#71036: closed (Re: bug#70889: 29.3; GCC14.1 MinGW compilation error)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 19 May 2024 10:25:04 +0000

Your bug report

#70889: build failure on Windows with MinGW-w64 GCC 14.1

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
70889: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70889
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#70889: 29.3; GCC14.1 MinGW compilation error
From: Eli Zaretskii <[email-masked]>
To: Cyril Arnould <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sun, 19 May 2024 13:24:29 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Sun, 19 May 2024 12:06:19 +0200
> Cc: [email-masked], [email-masked]
> From: Cyril Arnould <[email-masked]>
> 
>  > Now done on the master branch.  People who use GCC 14 on Windows
>  > please test and report any problems you see.
> 
> Just updated, the following builds with no issues:
> 
> ./autogen.sh
> ./configure
> make

Thanks for testing, I'm therefore closing this bug.

Subject: build failure on Windows with MinGW-w64 GCC 14.1
From: Richard Copley <[email-masked]>
To: [email-masked]
Date: Sat, 18 May 2024 12:55:02 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Emacs fails to build on Windows with the current MSYS2 GCC 14.1 toolchain.

TL;DR: -Werror=implicit-function-declaration is now the default.
Please see <https://gcc.gnu.org/gcc-14/porting_to.html>. This breaks
the test for "sys/wait.h" in "./configure".

The error is:
  CC       sysdep.o
sysdep.c: In function 'get_child_status':
sysdep.c:479:13: error: implicit declaration of function 'waitpid'
[-Wimplicit-function-declaration]
  479 |       pid = waitpid (child, status, options);
      |             ^~~~~~~
sysdep.c:479:13: warning: nested extern declaration of 'waitpid'
[-Wnested-externs]
sysdep.c: In function 'child_status_changed':
sysdep.c:525:43: error: 'WNOHANG' undeclared (first use in this function)
  525 |   return get_child_status (child, status, WNOHANG | options, 0);
      |                                           ^~~~~~~
sysdep.c:525:43: note: each undeclared identifier is reported only
once for each function it appears in
sysdep.c:526:1: warning: control reaches end of non-void function
[-Wreturn-type]
  526 | }
      | ^
make[2]: *** [Makefile:452: sysdep.o] Error 1

With the previous GCC 13.2 toolchain the build succeeds. The relevant
parts of the two builds' config.log are below, followed by a diff of
the output of "./configure".
Note that -Werror=implicit-function-declaration is now the default.
Please see <https://gcc.gnu.org/gcc-14/porting_to.html>.

==== GCC 13.2 ====

configure:14931: checking for sys/wait.h that is POSIX.1 compatible
configure:14958: gcc -I ./nt/inc -c -g3 -O2 -gdwarf-2 -mtune=generic
conftest.c >&5
conftest.c: In function 'main':

conftest.c:68:3: warning: implicit declaration of function 'wait'
[-Wimplicit-function-declaration]

   68 |   wait (&s);

      |   ^~~~

configure:14958: $? = 0
configure:14968: result: yes

==== GCC 14.1 ====

configure:14931: checking for sys/wait.h that is POSIX.1 compatible
configure:14958: gcc -I ./nt/inc -c -g3 -O2 -gdwarf-2 -mtune=generic
conftest.c >&5
conftest.c: In function 'main':

conftest.c:69:3: error: implicit declaration of function 'wait'
[-Wimplicit-function-declaration]

   69 |   wait (&s);

      |   ^~~~

configure:14958: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Emacs"
| #define PACKAGE_TARNAME "emacs"
| #define PACKAGE_VERSION "30.0.50"
| #define PACKAGE_STRING "GNU Emacs 30.0.50"
| #define PACKAGE_BUGREPORT "[email-masked]"
| #define PACKAGE_URL "https://www.gnu.org/software/emacs/"
| #define MAIL_USE_POP 1
| #define HAVE_PDUMPER 1
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_PWD_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_SYS_CDEFS_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_STDBOOL_H 1
| #define HAVE_STDCKDINT_H 1
| #define STDC_HEADERS 1
| #define _ALL_SOURCE 1
| #define _DARWIN_C_SOURCE 1
| #define _GNU_SOURCE 1
| #define _HPUX_ALT_XOPEN_SOCKET_API 1
| #define _NETBSD_SOURCE 1
| #define _OPENBSD_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
| #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
| #define __STDC_WANT_IEC_60559_DFP_EXT__ 1
| #define __STDC_WANT_IEC_60559_EXT__ 1
| #define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
| #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
| #define __STDC_WANT_LIB_EXT2__ 1
| #define __STDC_WANT_MATH_SPEC_FUNCS__ 1
| #define _TANDEM_SOURCE 1
| #define __EXTENSIONS__ 1
| #define _FILE_OFFSET_BITS 64
| #define __USE_MINGW_ANSI_STDIO 1
| #define GCC_LINT 1
| #define SYSTEM_TYPE "windows-nt"
| #define HAVE_MMSYSTEM_H 1
| #define HAVE_SOUND 1
| /* end confdefs.h.  */
| #include <sys/types.h>
| #include <sys/wait.h>
| #ifndef WEXITSTATUS
| # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
| #endif
| #ifndef WIFEXITED
| # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
| #endif
|
| int
| main (void)
| {
|   int s;
|   wait (&s);
|   s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
|   ;
|   return 0;
| }
configure:14968: result: no

==== "./configure" output diff ====

--- build.log
+++ build-14.1.0-3.log
@@ -62,7 +62,7 @@
 checking for limits.h... yes
 checking for sys/select.h... no
 checking for stdbool.h... yes
-checking for stdckdint.h... no
+checking for stdckdint.h... yes
 checking for sys/random.h... no
 checking whether it is safe to define __EXTENSIONS__... yes
 checking whether _XOPEN_SOURCE should be defined... no
@@ -87,14 +87,14 @@
 checking whether C compiler handles -Wduplicated-cond... yes
 checking whether C compiler handles -Wextra... yes
 checking whether C compiler handles -Wformat-signedness... yes
-checking whether C compiler handles -Wflex-array-member-not-at-end... no
+checking whether C compiler handles -Wflex-array-member-not-at-end... yes
 checking whether C compiler handles -Winit-self... yes
 checking whether C compiler handles -Winvalid-pch... yes
 checking whether C compiler handles -Wlogical-op... yes
 checking whether C compiler handles -Wmissing-declarations... yes
 checking whether C compiler handles -Wmissing-include-dirs... yes
 checking whether C compiler handles -Wmissing-prototypes... yes
-checking whether C compiler handles -Wmissing-variable-declarations... no
+checking whether C compiler handles -Wmissing-variable-declarations... yes
 checking whether C compiler handles -Wnested-externs... yes
 checking whether C compiler handles -Wnull-dereference... yes
 checking whether C compiler handles -Wold-style-definition... yes
@@ -148,7 +148,7 @@
 checking for _oss_ioctl in -lossaudio... no
 checking for alsa >= 1.0.0... no
 checking for ADDR_NO_RANDOMIZE... no
-checking for sys/wait.h that is POSIX.1 compatible... yes
+checking for sys/wait.h that is POSIX.1 compatible... no
 checking for net/if.h... no
 checking for ifaddrs.h... no
 checking for net/if_dl.h... no