Comment by xvilka
10 days ago
Clang is the better alternative to MinGW because it can use standard Windows libraries and avoids the need for additional runtime.
10 days ago
Clang is the better alternative to MinGW because it can use standard Windows libraries and avoids the need for additional runtime.
Can you actually do cross compilation (on Linux host to win64 binary) with clang in the same way as MingW does out of the box though?
No. You cannot even do direct compilation on the same host and target with clang only.
LLVM doesn't come with the C library headers (VCRuntime) or the executable runtime startup code (VCStartup).Both of which are under Visual Studio proprietary licenses. So to use Clang on Windows without Mingw, you need Visual Studio.
I use MingW without any extra libs (no msys), it just uses the ancient msvcrt.dll that is present in all Windows versions, so my programs work even on Windows 2000.
Additionally the cross-compiler on Linux also produces binaries with no extra runtime requirements.
You can use Mingw-w64 UCRT or CLANG environments that come with MSYS2.
Compared to older Mingw64 environments those link with the latest UCRT so you get almost the same style executable as Visual Studio.
The only difference for C is that it uses Mingw exception handling and global initialization code, and it uses Itanium ABI for C++.
But that's the point, I don't want the same style executable as Visual Studio. Having to distribute bunch of DLLs and having worse compatibility is pretty bad.
A major part of the incompatibility with older versions of Windows is just because newer VS runtimes cut the support artifically. That's it. Many programs would otherwise work as-is or with just a little help.
1 reply →
Just msys2 it all
MSYS2 is horrible. It brings a massive runtime environment and is a bad idea to foist on users.
Aren’t you thinking of Cygwin, or the MSYS2 shell (dev tooling)?
The Windows-native software you build with MSYS2 can be shipped to and run by users that don’t have anything of MSYS2 installed.
16 replies →
MSYS2 UCRT also uses the native Windows libraries (aka. UCRT).