all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: bug-gnulib@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: Emacs build fails on Windows mingw64
Date: Sun, 24 Oct 2021 18:57:48 +0100	[thread overview]
Message-ID: <86h7d61f1f.fsf@gmail.com> (raw)
In-Reply-To: 349dbe47-58a7-cc27-5dd5-408168820aeb@cs.ucla.edu

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" redefined
    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).

    AndyM




  parent reply	other threads:[~2021-10-24 17:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <86v91nfp6e.fsf@gmail.com>
2021-10-24  3:45 ` Emacs build fails on Windows mingw64 Paul Eggert
2021-10-24  6:26   ` Eli Zaretskii
2021-10-24 10:50     ` Andy Moreton
2021-10-24 12:27       ` Paul Eggert
2021-10-24 12:25     ` Paul Eggert
2021-10-24 13:58       ` Eli Zaretskii
2021-10-24 17:05         ` Paul Eggert
2021-10-24 17:48           ` Eli Zaretskii
2021-10-24 17:57           ` Andy Moreton [this message]
2021-10-24 22:52             ` Bruno Haible
2021-10-25 11:52               ` Eli Zaretskii
2021-10-25 21:26               ` Andy Moreton
2021-10-24 18:01           ` Óscar Fuentes
2021-10-24 18:10             ` 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=86h7d61f1f.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=bug-gnulib@gnu.org \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.