[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building with MSYS2 UCRT64
From: |
Arash Esbati |
Subject: |
Re: Building with MSYS2 UCRT64 |
Date: |
Wed, 26 Jan 2022 14:45:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 |
Loreno Heer <helohe@bluewin.ch> 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/