From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook? Date: Tue, 13 Feb 2024 20:00:16 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24037"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org, eliz@gnu.org To: Angelo Graziosi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 13 21:07:25 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rZz3s-00064U-Gz for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Feb 2024 21:07:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZyzh-0003FO-K5; Tue, 13 Feb 2024 15:03:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZy16-0004Il-EY for emacs-devel@gnu.org; Tue, 13 Feb 2024 14:00:28 -0500 Original-Received: from mail-db3eur04olkn2029.outbound.protection.outlook.com ([40.92.74.29] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZy14-0007ab-1V; Tue, 13 Feb 2024 14:00:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VFQOqT6aBV9IKSsbcy1QtQbOhgWGR6dkiyVc6wElZYTdvl/kvYLTe8+m/SBKu4yDPwqAVSCGJO4xHcRHRRe7WDgF70A9WQsvZOvm5H2J/loK8Hf/SmIYtcGyOTUW//16+4cQO8QpD36C4Qx9Q5O2JzPSh+Osh54hsEnE4wHr9m6bPBzk2OCNZkFcsbf1t5wBIfdeEMTUzIpJEiPgXRJJ5GD6qqPYAfe9/halTajS/jG78D+6/IS9uX+U2C26z2vYo54kolKYqnkHqa+s/u5czjWy3TU6wGKSg4aKM9RxXZY6LY7Kgs5Gfn8HQ+KkwDFs1AL/haiOaz9IcwY3cyUNig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bT/3uPgWu2PtidEyh/m5RBOVDccn2ShD9R5Hxk9Eszw=; b=byqcCKOC9ycgdeCC4525lmq8YSLfPsSUy/RZHJ340XG3jhXNuQX3D60LguSRu9OqwcP3y8oEmidu+P88TmH+vqcPA1C2LGT9y1wmJHkVS6osP7hpm8tDLd0XTH9ok1MPzYHd/4urJXjflSYLjlnExFWmpGNd49epN3LFVC/D5K/U1hhI19gcOOcM4Q5Rtyj/UPAi66GCuuguHHKLP82gUNV8y86+sPKctk0eC94CaaRUjaUCSOvIPa/8FCYV0EZRjYeniNCUG2kmO6bXKUW+FMHkeUwq2ckiAGRQccNUry4QSKieCNDWxHE7atorNgdQ6fMQna7YDKwFp4vxadBI6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bT/3uPgWu2PtidEyh/m5RBOVDccn2ShD9R5Hxk9Eszw=; b=RMG6zgQMWITR7uMG3oAtzhibJJ9fhYrdgeLCh42TKc6sl/H6AhwMtbQQLhpZRfibWqShdlKDDbSt5ikoSwRxI3/8YzeajSzKfWQIku/O6RgJTSPv2sY+hUbi+UCsFBIQjbqmIV4p7GGJU3AZoq0HgjnNMuOZFdsqHA/UIqyyMf67VV32XzZpc2NnWCbfyz2bhygobEVWpVaZxMTQG8d6Jmoez7cjZZP9wy4+NKLucwGCAOA9gThj22TXCZWHi3Si5TaDxS/0RRGQlsFgvpOJKmnmBS8b+8Sgona5YcPQUqlUxeYM9YhW9eHglGbQlHbjZmpgoWbCeiifvXE024dVEA== Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) by DU0PR02MB7826.eurprd02.prod.outlook.com (2603:10a6:10:342::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.28; Tue, 13 Feb 2024 19:00:22 +0000 Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::1752:9b0:4c48:15f8]) by DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::1752:9b0:4c48:15f8%7]) with mapi id 15.20.7270.036; Tue, 13 Feb 2024 19:00:22 +0000 In-Reply-To: (Angelo Graziosi's message of "Mon, 12 Feb 2024 18:37:50 +0100") X-TMN: [xlmy5bCfaUmNjRY7h8Twmxaw1KyZLpzb] X-ClientProxiedBy: MM0P280CA0081.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:8::31) To DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) X-Microsoft-Original-Message-ID: <86plx06vgf.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR02MB10109:EE_|DU0PR02MB7826:EE_ X-MS-Office365-Filtering-Correlation-Id: d90d1390-1850-4e04-8c7f-08dc2cc6072a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8s65wbTWfpk97CblaTilUuWCZ1LcL9GemilefwfuvbvbudF6Y92Z656DYbrTyP13VjcF0K9JTQHC6gOgM4Ry2cKaxa/jD0HhqWO64ZrPfON9c7mi1S1gcVdG5w5bKhGRhFvjhJConRiWRTWDOCYsFEuPss04GkWo8NNCUW2SUe4mq9InAvuu3vgk3yTR6UWHxwXoa9dhndUeagcKehX3QQBbzOSM+Rq5icrA9vuyVSSRpMiA4IqfG+RWKe32BdD8NsvR5wMjKc7TdLkVk7Qb3JH52iw/4iOC91fZ+BJ6cwT3+PE1M1WnBe8/IBRO6wDMnsjgTm5hYgPUlNjS6XQrItlqBRH3KfxZO20+bN6fwIe0D0EHdVXo7mxJ+hjmWzXs68HPPn1kj5vHw4zjUbTJ1tOvY6lEtuXzgf1E0LliuCfNrVPFHq+RlQEswisyve8EID9PlfjaDQnx9I2pSpQ89+TeKhsmB/Iy20ZGzeY9V4y+nv6I9Lx1Zm/YOFaL5EzB4cP0w+uwE2dFa6hNx1PhudFBcuvtec/8X8Zv5p/IHD6TGSoY+gE4amXpwf6KjgIZTqUB7D9aAvJZ1lrLhEsrWdlyqHB42bnuXHTiUXjHvx68BeNSfrEV9jad8FEhPnF/ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DEkO2QdlAXBcq/NguCtNfoRr5ezBfN2qR2FAHzKGJ0tSr2yNg/yjK5a9BNoB?= =?us-ascii?Q?dPnVXD/tcf0DHAtUFR2HMk7rfZ2Q/k1OmI6iswAkbOMTmiL5KikLGRO2JOFY?= =?us-ascii?Q?/LdskItDW/xfSxIgXZJspHS+fOuYOplaGpY/0m+YiENrLAaSp024iCDaP4dB?= =?us-ascii?Q?dRT5z2ewAW+LcwM3/hLsXDmSgqmGLLX3cO3K77umvXOBV7R3tphnd/UFz53q?= =?us-ascii?Q?V1m12jPyqaeEd3Zdex+7scHTnKvrmrwz5AlexHLpGE5Da8FUyo0MscqRYUWL?= =?us-ascii?Q?JMGqFz9a2PaeA1KfRnv0dMriTVLCbIPgN4Rnn0WrSeKypJgdrtEAEawTGT0K?= =?us-ascii?Q?XInCThZHstLaiaJjmPtLW7OzTbS0THp//ZfO/GLgjQUxHSsdMQm9Z9GIR1Or?= =?us-ascii?Q?GNrkQQcp/67w5LnFifvR7/bRZobTIAdHKFG4hytaNM0NI1yiejS9XA4kNk7s?= =?us-ascii?Q?BAJydsXcrg3S2O/r+Ds9pfK7yXFkTSk3nQpF6dIARD82aK67Rl/27vAKp64x?= =?us-ascii?Q?wdaUvWlerx/4O1JGRDA6QyBmh52P6Hb2mFaiRAhaJHtXxqj+Psi0xvITJi6D?= =?us-ascii?Q?IYaHYRlfqJhedLrmLRUEwisGic6mgl9YDqwvEbO4M5i2h7WeuNk3QD8s9tR4?= =?us-ascii?Q?S3 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-ab7de.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d90d1390-1850-4e04-8c7f-08dc2cc6072a X-MS-Exchange-CrossTenant-AuthSource: DU2PR02MB10109.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 19:00:22.0162 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR02MB7826 Received-SPF: pass client-ip=40.92.74.29; envelope-from=arthur.miller@live.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 13 Feb 2024 15:02:05 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316185 Archived-At: --=-=-= Content-Type: text/plain Angelo Graziosi 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Compile-with-mingw-UCRT-runtime.patch >From 22ea9383e28fff60c9880d7d8e6c5102bb43a8d7 Mon Sep 17 00:00:00 2001 From: Arthur Miller 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 /* strlen */ #include /* 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__ */ } -- 2.43.1 --=-=-=--