From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.help Subject: Re: Building with MSYS2 UCRT64 Date: Wed, 26 Jan 2022 14:45:59 +0100 Message-ID: <86sftabofc.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19048"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 Cc: help-gnu-emacs@gnu.org To: Loreno Heer Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 26 15:11:30 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1nCj1F-0004kq-Sq for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Jan 2022 15:11:30 +0100 Original-Received: from localhost ([::1]:56976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCj1E-0008Oj-Kh for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Jan 2022 09:11:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCicr-0000N7-Kp for help-gnu-emacs@gnu.org; Wed, 26 Jan 2022 08:46:17 -0500 Original-Received: from [2001:470:142:3::e] (port=59532 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCicq-0000Kl-8Q; Wed, 26 Jan 2022 08:46:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=WdBYVOD0A05Ohdx/ntkgZxt6X/ulySgPmOkNt3QHU4g=; b=mOhWstt9DQ9uWByFswJF G7erSEsG1CCi2KZ/oS1wBBpx7wHdQRNRBAhrDgM20iaZ2M9fzyTk3rOzKG4mACacAnnQFjFOUmqYg J9rsQ/ZH1k6F21b3LSpsjnUhH9jGVGxFTmToFJWpzFcbFyfK0ksAB2etzF1ey+CagLejlNVh8wvpT ubGe6melqZ71FZH0QkO+d1ZJLpI1qAWU6WC8pHGnwyBSxsKpKCgO/0+jvaKqA/03OidLoIsGJzMkd p8QwJRsBLgInubU/ateZw62IuykzJoDOVGOytVPbnFhwhSZdRpS+9ENWNJL342Q6ZB5w6YjjHMVwo d/m0QZAXYBAeZw==; Original-Received: from p4fe3e9f7.dip0.t-ipconnect.de ([79.227.233.247]:55826 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCicp-0002kh-Rx; Wed, 26 Jan 2022 08:46:16 -0500 In-Reply-To: (Loreno Heer's message of "Wed, 26 Jan 2022 11:16:32 +0100") X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135534 Archived-At: Loreno Heer writes: > I can succesfully build emacs with MINGW64 (msvcrt) but if I try to > build it using UCRT64 (ucrt) I get a bunch of errors: > > C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: > C:\msys64\tmp\ccoT9xeo.o: in function `main': > C:\msys64\home\User\src\emacs\nt/cmdproxy.c:874: undefined reference to > `_snprintf' > > ... > > Looks like _snprintf is not defined when using ucrt. > > Not sure if this is a problem of emacs, msys or windows 7. I've never tried it, but acc. to this page[1], I'd say it is Win7: --8<---------------cut here---------------start------------->8--- MSVCRT vs UCRT These are two variants of the C standard library on Microsoft Windows. MSVCRT (Microsoft Visual C++ Runtime) is available by default on all Microsoft Windows versions, but due to backwards compatibility issues is stuck in the past, not C99 compatible and is missing some features. - It isn't C99 compatible, for example the printf() function family, but... - mingw-w64 provides replacement functions to make things C99 compatible in many cases - It doesn't support the UTF-8 locale - Binaries linked with MSVCRT should not be mixed with UCRT ones because the internal structures and data types are different. (More strictly, object files or static libraries built for different targets shouldn't be mixed. DLLs built for different CRTs can be mixed as long as they don't share CRT objects, e.g. FILE*, across DLL boundaries.) Same rule is applied for MSVC compiled binaries because MSVC uses UCRT by default (if not changed). - Works out of the box on every Microsoft Windows versions. UCRT (Universal C Runtime) is a newer version which is also used by Microsoft Visual Studio by default. It should work and behave as if the code was compiled with MSVC. - Better compatibility with MSVC, both at build time and at run time. - It only ships by default on Windows 10 and for older versions you have to provide it yourself or depend on the user having it installed. --8<---------------cut here---------------end--------------->8--- Best, Arash Footnotes: [1] https://www.msys2.org/docs/environments/