all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Angelo Graziosi <angelo.g0@libero.it>
Cc: emacs-devel@gnu.org, eliz@gnu.org
Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook?
Date: Tue, 13 Feb 2024 20:00:16 +0100	[thread overview]
Message-ID: <DU2PR02MB1010909ACB78B97EDEB2F1C3D964F2@DU2PR02MB10109.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <c666c02b-193c-4d10-85da-a525ed1059b1@libero.it> (Angelo Graziosi's message of "Mon, 12 Feb 2024 18:37:50 +0100")

[-- Attachment #1: Type: text/plain, Size: 2463 bytes --]

Angelo Graziosi <angelo.g0@libero.it> writes:

>> ld is complaining about missing snprintf
>
> BTW, MSYS2 people build Emacs for UCRT64 with a few patches. See:
>
> https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-emacs
>
> I use those patches also for my Emacs master builds.

I was not able to apply their patches to the current master; git apply refused.
Seems like their patch is for Emacs 28.2. Instead I have manually patched-in their
changes to the sources and was able to build it. Typing from it.

More than the patch, I also had to copy over cp.exe from msys/bin to ucrt64/bin,
because the cp.exe included in ucrt runtime failed in autogen or configure; I
don't remember, with message that --force flag is not implemented yet, when some
script was installing git hooks.

Emacs seems to work as usual thus far, but the native compiler complains about
missing function:

Debugger entered--Lisp error: (void-function comp-write-bytecode-file)
  comp-write-bytecode-file("c:/Users/arthu/.emacs.d/eln-cache/30.0.50-ccd5287a/dired-auto-readme-d510bed9-ac3fa899.eln")
  emacs-lisp-native-compile()
  emacs-lisp-native-compile-and-load()
  funcall-interactively(emacs-lisp-native-compile-and-load)
  command-execute(emacs-lisp-native-compile-and-load)


I also did got the message that Emacs is not functional at the end of the build:

  GEN      ../../info/efaq-w32.info
org.texi:15658: warning: @anchor should not appear on @item line
org.texi:15671: warning: @anchor should not appear on @item line
make[2]: Leaving directory '/c/Users/arthu/repos/emsrc/ucrt-w64/doc/misc'
make[1]: Leaving directory '/c/Users/arthu/repos/emsrc/ucrt-w64'
make sanity-check make-target=all
make[1]: Entering directory '/c/Users/arthu/repos/emsrc/ucrt-w64'
***
*** "make all" succeeded, but Emacs is not functional.
***
*** You could try to:
*** - run "make bootstrap", which might fix the problem
*** - run "make V=1", which displays the full commands invoked by make,
***   to further investigate the problem
***
make[1]: *** [Makefile:424: sanity-check] Error 1
make[1]: Leaving directory '/c/Users/arthu/repos/emsrc/ucrt-w64'
make: *** [Makefile:375: all] Error 2

arthu@Emmi UCRT64 ~/repos/emsrc/ucrt-w64
$ nt/runemacs.exe &
[1] 11791

However; I am running Emacs, it byte-compiles, loads stuff, runs my setup and
everything seems to work as usual.

I did make V=1, but see nothing failing, in make script.

> Ciao,
>  Angelo.

Thanks for the pointer;

Ciao


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Compile-with-mingw-UCRT-runtime.patch --]
[-- Type: text/x-patch, Size: 1462 bytes --]

From 22ea9383e28fff60c9880d7d8e6c5102bb43a8d7 Mon Sep 17 00:00:00 2001
From: Arthur Miller <arthur.miller@live.com>
Date: Tue, 13 Feb 2024 19:35:20 +0100
Subject: [PATCH] Compile with mingw UCRT runtime.

---
 nt/cmdproxy.c | 4 ++++
 src/sysdep.c  | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c
index 0500b653bb2..59ffe2c4db7 100644
--- a/nt/cmdproxy.c
+++ b/nt/cmdproxy.c
@@ -38,6 +38,10 @@ #define DEFER_MS_W32_H
 #include <string.h>  /* strlen */
 #include <ctype.h>   /* isspace, isalpha */
 
+#ifdef _UCRT
+#define _snprintf snprintf
+#endif
+
 /* We don't want to include stdio.h because we are already duplicating
    lots of it here */
 extern int _snprintf (char *buffer, size_t count, const char *format, ...);
diff --git a/src/sysdep.c b/src/sysdep.c
index 3a6829dd27a..9adff04d45f 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2983,8 +2983,10 @@ close_output_streams (void)
 #else /* !__ANDROID__ */
   if (close_stream (stdout) != 0)
     {
+#ifndef _UCRT
       emacs_perror ("Write error to standard output");
       _exit (EXIT_FAILURE);
+#endif
     }
 
   /* Do not close stderr if addresses are being sanitized, as the
@@ -2993,7 +2995,11 @@ close_output_streams (void)
   if (err | (ADDRESS_SANITIZER
 	     ? fflush (stderr) != 0 || ferror (stderr)
 	     : close_stream (stderr) != 0))
+#ifndef _UCRT
     _exit (EXIT_FAILURE);
+#else
+    ;
+#endif
 #endif /* __ANDROID__ */
 }
 \f
-- 
2.43.1


  parent reply	other threads:[~2024-02-13 19:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 17:37 Missing snprintf in ucrt mingw + vc-refresh in find-file hook? Angelo Graziosi
2024-02-13 10:49 ` Arthur Miller
2024-02-13 19:00 ` Arthur Miller [this message]
2024-02-13 20:01   ` Eli Zaretskii
2024-02-13 22:05     ` Arthur Miller
2024-02-14 14:45       ` Eli Zaretskii
2024-02-14 18:43         ` Arthur Miller
2024-02-13 21:26   ` Angelo Graziosi
2024-02-13 22:09     ` Arthur Miller
2024-02-13 22:21       ` Angelo Graziosi
2024-02-13 22:26         ` Arthur Miller
  -- strict thread matches above, loose matches on Subject: below --
2024-02-12 10:06 Arthur Miller
2024-02-12 13:44 ` Dmitry Gutov
2024-02-12 13:56   ` Arthur Miller
2024-02-12 14:58     ` Dmitry Gutov
2024-02-12 16:49       ` Eli Zaretskii
2024-02-12 18:05         ` Dmitry Gutov
2024-02-12 19:15           ` Eli Zaretskii
2024-02-12 19:25             ` Dmitry Gutov
2024-02-12 19:34               ` Eli Zaretskii
2024-02-13  9:47       ` Arthur Miller
2024-02-13 13:36         ` Eli Zaretskii
2024-02-13 14:30           ` Arthur Miller
2024-02-13 21:26           ` Dmitry Gutov
2024-02-13 23:10             ` Arthur Miller
2024-02-14  3:42               ` Dmitry Gutov
2024-02-14 21:04                 ` Arthur Miller
2024-02-14 22:37                   ` Dmitry Gutov
2024-02-15 11:16                     ` Arthur Miller
2024-02-14 14:30             ` Eli Zaretskii
2024-02-14 16:36               ` Dmitry Gutov
2024-02-14 16:51                 ` Eli Zaretskii
2024-02-14 17:01                   ` Dmitry Gutov
2024-02-14 17:29                     ` Eli Zaretskii
2024-02-14 21:05                       ` Dmitry Gutov
2024-02-12 14:36 ` Eli Zaretskii
2024-02-13 10:44   ` Arthur Miller
2024-02-13 13:13     ` 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=DU2PR02MB1010909ACB78B97EDEB2F1C3D964F2@DU2PR02MB10109.eurprd02.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=angelo.g0@libero.it \
    --cc=eliz@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.