Environments
MSYS2 comes with different environments and the first thing you haveto decide is which one to use. The differences among the environments aremainly environment variables, default compilers/linkers, architecture,system libraries used etc. If you are unsure, go withUCRT64.
TheMSYS environment contains the unix-like/cygwin based tools, lives under/usr and is special in that it is always active. All the other environmentsinherit from theMSYS environment and add various things on top of it.
For example, in theUCRT64 environment the$PATH variable starts with/ucrt64/bin:/usr/bin so you get all ucrt64 based tools as well as all msystools.
Overview
| Name | Prefix | Toolchain | Architecture | C Library | C++ Library | |
|---|---|---|---|---|---|---|
![]() | MSYS | /usr | gcc | x86_64 | cygwin | libstdc++ |
![]() | UCRT64 | /ucrt64 | gcc | x86_64 | ucrt | libstdc++ |
![]() | CLANG64 | /clang64 | llvm | x86_64 | ucrt | libc++ |
![]() | CLANGARM64 | /clangarm64 | llvm | aarch64 | ucrt | libc++ |
![]() | MINGW64 | /mingw64 | gcc | x86_64 | msvcrt | libstdc++ |
| Name | Prefix | Toolchain | Architecture | C Library | C++ Library | |
|---|---|---|---|---|---|---|
![]() | CLANG32 | /clang32 | llvm | i686 | ucrt | libc++ |
![]() | MINGW32 | /mingw32 | gcc | i686 | msvcrt | libstdc++ |
The active environment is selected via theMSYSTEM environment variable.SettingMSYSTEM toUCRT64 and starting a login shell will put you in thatenvironment.
GCC vs LLVM/Clang
These are the default compilers/toolchains used for building all packages in therespective repositories.
GCC based environments:
- Widely tested/used at this point
- While there also exists a Clang package in the MINGW environments, that one still uses the GNU linker and the GNU C++ library. In some cases Clang is used to build packages as well there, in case upstream prefers Clang over GCC for example.
LLVM/Clang based environments:
- Only uses LLVM tools, LLD as a linker, LIBC++ as a C++ standard library
- Clang provides ASAN support
- Native support for TLS (Thread-local storage)
- LLD is faster than LD, but does not support all the features LD supports
- Some tools lack feature parity with equivalent GNU tools
- Supports ARM64/AArch64 architecture on Microsoft Windows 10
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 allMicrosoft Windows versions, but due to backwards compatibility issues isstuck 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 version of Microsoft Windows.
UCRT (Universal C Runtime) is a newer version which is also used byMicrosoft Visual Studio by default. It should work and behave as if thecode was compiled with MSVC.
- Better compatibility with MSVC, both at build time and at run time.
- It is included as part of the operating system in Windows 10 or later, and Windows Server 2016 or later. For older Windows versions, you have to provide it explicitly or depend on the user having it installed. More information about that can be found inUCRT deployment.
Changelog
2024-12-18: Removed CLANG32 environment.
2023-12-13: Start of phase out for 32-bit environments, MINGW32 and CLANG32. SeeNEWS for more information.
2022-12-30: Added CLANGARM64 environment.
2022-10-29: Changed the default environment from MINGW64 to UCRT64. SeeNEWS for more information.
2022-05-01: Added CLANG32 environment.
2022-04-23: Added CLANG64 environment.
2021-03-26: Added UCRT64 environment.
2020-05-17: Dropped 32-bit variant of the MSYS environment. SeeNEWS for more information.






