Skip to content

update zig's bundled mingw-w64 libc to support older Windows versions #4943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dr3murr opened this issue Apr 5, 2020 · 4 comments
Open
Labels
os-windows proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone

Comments

@dr3murr
Copy link

dr3murr commented Apr 5, 2020

zig cc produces binaries requiring a Windows version of at least 6.0 (Vista).
mingw32 builds binaries that run perfectly well on my Windows 95 box, so this is probably a regression somewhere.

@daurnimator
Copy link
Contributor

What are you passing as the target? See #1907 (comment)

@andrewrk
Copy link
Member

andrewrk commented Apr 5, 2020

Here is the process for how mingw-w64 is configured: https://github.com/ziglang/zig/wiki/Updating-libc#mingw-w64-windows

We currently pass --with-default-win32-winnt=0x0603.

@andrewrk andrewrk added the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Apr 5, 2020
@andrewrk andrewrk changed the title zig cc produces Windows binaries requiring Windows Vista or newer update zig's bundled mingw-w64 libc to support older Windows versions Apr 5, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Apr 5, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 27, 2020
@zu3st
Copy link

zu3st commented May 11, 2021

What are you passing as the target? See #1907 (comment)

Running zig cc hello.c -target i386-windows.xp-gnu results in the PE's subsystem version header being set to 6, consequently the output cannot be run on Windows XP.

After bytepatching the subsystem version header from 6 to 4, the program runs just fine.

dumpbin excerpt:

OPTIONAL HEADER VALUES
  6.00 operating system version
  0.00 image version
  6.00 subsystem version
  0 Win32 version

@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 May 19, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 Nov 23, 2021
@andrewrk andrewrk modified the milestones: 0.10.0, 0.11.0 Apr 16, 2022
@sskras
Copy link

sskras commented Jan 2, 2023

@andrewrk commented Apr 6, 2020:

Here is the process for how mingw-w64 is configured: https://github.com/ziglang/zig/wiki/Updating-libc#mingw-w64-windows

We currently pass --with-default-win32-winnt=0x0603.

The larger excerpt:

rm -rf $ZIGSRC/lib/libc/include/any-windows-any
cd mingw-w64-headers
./configure --prefix=/tmp/prefix --with-default-win32-winnt=0x0603
make install
mv /tmp/prefix/include $ZIGSRC/lib/libc/include/any-windows-any

...
Next, update all the files in lib/libc/mingw/*.

Does it mean that mingw-w64 needs to be reconfigured / rebuilt before building binaries for Windows XP / Server 2003 / ReactOS using zig cc?

@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Apr 9, 2023
@andrewrk andrewrk modified the milestones: 0.13.0, 0.12.0 Jul 9, 2023
@andrewrk andrewrk modified the milestones: 0.14.0, unplanned Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os-windows proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Projects
None yet
Development

No branches or pull requests

5 participants