-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
make "gnu" (mingw-w64) the default C ABI on Windows #6565
Copy link
Copy link
Closed
Labels
acceptedThis proposal is planned.This proposal is planned.os-windowsMicrosoft WindowsMicrosoft WindowsproposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.
Milestone
Metadata
Metadata
Assignees
Labels
acceptedThis proposal is planned.This proposal is planned.os-windowsMicrosoft WindowsMicrosoft WindowsproposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.
Currently if you download Zig on Windows, and then try to build some C code, without MSVC installed, you get an error saying that Zig cannot find or provide a libc. This is a shame because we actually can provide a libc! The magic sauce is
-target native-native-gnuwhich uses mingw-w64 to provide libc.This proposal is to make -gnu the default on windows rather than -msvc. This C ABI is binary-compatible with MSVC-compiled code, however the header files are not source-compatible with MSVC libc header files. When zig is responsible for compiling all of the C, C++, and Zig code for a given project, then there is 0 downsides to using mingw-w64 as the C ABI. The upsides are huge: no dependency on MSVC being installed. Zig acts as a C and C++ compiler that works out of the box, without MSVC installed.
I discussed this with @mlarouche on IRC and he indicated that it may sometimes be useful to specify
-target native-native-msvcbut that it does make sense to make the default mingw-w64.Some more tid bits:
Related: #6363