[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs build fails on Windows mingw64

From: Andy Moreton
Subject: Re: Emacs build fails on Windows mingw64
Date: Sun, 24 Oct 2021 18:57:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt)

On Sun 24 Oct 2021, Paul Eggert wrote:

> On 10/24/21 9:58 AM, Eli Zaretskii wrote:
>> We could try all that, but not on the release branch.  There, I'd like
>> a simple and safe fix.  Is such a thing possible?
> Andy suggested a simple fix that I quoted here:
> https://lists.gnu.org/r/emacs-devel/2021-10/msg01698.html
> We could apply that patch just to ntlib.c and just in emacs-28 (do not merge
> to master) as Andy says that works for him;

Yes, that minimal fix bootstraps on emacs-28 and master with 64bit mingw64.

> and we could then apply the more-systematic patch of
> <https://lists.gnu.org/r/emacs-devel/2021-10/msg01697.html> to master. Andy's
> patch is definitely safe for GNU and POSIXish hosts. I don't know whether it
> suffices for all MS-Windows platforms and Emacs builds.

The patch still needs some work:
a) The symbol in conf_post.h is DEFER_MS_W32_H (not DEFER_MS_W3_H),
   so needs fixing in the patch.
b) BASE_CFLAGS in nt/Makefile.in needs changes to match the include
   switches in lib-src/Makefile.in (so that config.h, conf_post.h 
   and attribute.h etc can be found).

After fixing those minor issues, emacs-28 bootstraps with only one
additional warning due to the patch:

  C:/emacs/git/emacs/emacs-28/lib-src/ntlib.c:294: warning: "IS_DIRECTORY_SEP" 
    294 | #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\')
  In file included from C:/emacs/git/emacs/emacs-28/lib-src/ntlib.c:24:
  ../src/config.h:1563: note: this is the location of the previous definition
   1563 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')

(There are a few other new warnings in the build with either approach,
probably due to additional checks that have appeared after upgrading from
gcc 10.3 to gcc 11.2.)

I understand Eli's desire to avoid using this patch on emacs-28 as the
changes are potentially destabilising this late in the release cycle.

>> Can you explain why config.h is needed there, and why only for GCC 11?
> config.h is needed because it defines macros used by lib/string.h and other
> lib/*.h files that come from Gnulib. I don't know why the problem occurs only
> for GCC 11 on MS-Windows platforms, as I would think it'd also occur with
> earlier GCC versions. Older GCC versions don't do the static checking I
> mentioned, so the macros do not help checking with older GCC. The macros can
> safely be #defined to empty as Andy's patch suggested, so long as config.h
> isn't included (as it would define them differently). The downsides of Andy's
> approach (as compared to the more-systematic patch) is that you lose out some
> static checking with recent GCC, and I worry (without really knowing) that
> similar problems may lurk in other MS-Windows-specific .c files on some other
> MS-Windows platforms.

My suggestion to define the macros was a minimal workaround to get
emacs building again for me until proper fix could be developed.

I suspect the issue has been in the gnulib header for some time, but has
only been triggered in the build after upgrading to gcc >=11 as
otherwise the relevant code is not built (it is guarded with a gcc
version check).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]