From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.comp.lib.gnulib.bugs,gmane.emacs.devel Subject: Re: Emacs build fails on Windows mingw64 Date: Sun, 24 Oct 2021 18:57:48 +0100 Message-ID: <86h7d61f1f.fsf@gmail.com> References: <86v91nfp6e.fsf@gmail.com> <0b467abe-dd50-6a0a-7d1f-37eb990900be@cs.ucla.edu> <83ee8b3pme.fsf@gnu.org> <867fb020-c32b-3a42-1910-385756846c6d@cs.ucla.edu> <8335oq4j8z.fsf@gnu.org> <349dbe47-58a7-cc27-5dd5-408168820aeb@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28111"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) Cc: emacs-devel@gnu.org To: bug-gnulib@gnu.org Cancel-Lock: sha1:LvhMqgrSQQAfrWObnaPQeCMWocc= Original-X-From: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Sun Oct 24 19:59:42 2021 Return-path: Envelope-to: gnu-bug-gnulib@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mehmX-00077j-38 for gnu-bug-gnulib@m.gmane-mx.org; Sun, 24 Oct 2021 19:59:41 +0200 Original-Received: from localhost ([::1]:44120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mehmV-0005fn-Dw for gnu-bug-gnulib@m.gmane-mx.org; Sun, 24 Oct 2021 13:59:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mehl8-0004QL-Fk for bug-gnulib@gnu.org; Sun, 24 Oct 2021 13:58:14 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:43344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mehl6-0006ZT-Oy for bug-gnulib@gnu.org; Sun, 24 Oct 2021 13:58:14 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mehl5-00058T-2R for bug-gnulib@gnu.org; Sun, 24 Oct 2021 19:58:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=gnu-bug-gnulib@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnulib" Xref: news.gmane.io gmane.comp.lib.gnulib.bugs:45181 gmane.emacs.devel:277671 Archived-At: 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 > 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