usage of MSYS2 environments
Asked Answered
M

1

8

I want to thoroughly understand the usage of environments from the MSYS2 platform. A partial description is available at: https://www.msys2.org/docs/environments/

Things I understand:

  1. MSYS environment it is used to build applications that will run only in the MSYS2 environment. There is a POSIX layer available through the cygwin C library. Applications are compiled with GCC for 64 bits (exception for 32 bit MSYS2 installed).

  2. MINGW64 environment it is used to create native Windows applications that run independently of the MSYS2 environment. Using the old MSVCRT technology. Applications are compiled with GCC for 64 bits.

  3. MINGW32 environment it is used to create native Windows applications that run independently of the MSYS2 environment. Using the old MSVCRT technology. Applications are compiled with GCC for 32 bits

  4. UCRT64 environment Applications are compiled with GCC for 64 bits. Using the newer UCRT technology.

  5. CLANG64 environment Applications are compiled with LLVM for 64 bits. Using the newer UCRT technology.

The difference between UCRT64 and CLANG64 is a different compiler. Clang (frontend for LLVM) is partially compatible with GCC commands.

My questions:

But when to use UCRT64 and when to use MINGW64? Can I build libraries with UCRT64 that I can link dynamically or statically then building a project with MSVC compiler? Is it possible to build a library with MSYS2 that I can link later using the MSVC compiler?

Mintamintage answered 1/8, 2021 at 3:9 Comment(3)
MINGW64 is old and time-tested. UCRT64 is new. UCRT64 supports UTF-8 in file paths (MINGW64 needs workarounds). I believe neither is compatible with MSVC (for C++, could be compatible for C), but this usually doesn't matter.Tegucigalpa
@Tegucigalpa It is possible: https://mcmap.net/q/1472197/-is-it-possible-to-use-a-gcc-compiled-library-with-msvcMintamintage
I find MSYS less messy after running path %PATH%; C:\msys2\usr\bin, which throws the binaries you install via pacman into the regular cmd shell, not their special one.Biologist
E
3

@HolyBlackCat: your answer could be wrongly interpreted by some readers. It's not wrong, but to understand the details, we should the readers point to MSYS2 Environment Overview.

My reading: The MINGW compilers are not outdated, but Mingw links the code to MSVCRT runtime library, which tends to die in some unknown time. UCRT links the code to the new (perhaps future proof?) ucrt runtime library, which could win the M$ race. But if the kind reader wants to link his binaries with some MSVCRT-made DLLs, LIBs or EXEs, he need to use Mingw.

Experimentation answered 19/10, 2022 at 17:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.