mingw: require Windows Vista or later (and fix the Windows CI builds)
cover mingw: require Windows Vista or later (and fix the Windows CI builds)
I noticed that a recent GitGitGadget build failed in the Windows phase, with compat/poll/poll.h problems all over the place.
Turns out that this is caused by the recent upgrade of the mingw-w64 headers and crt files (7.0.0.5233.e0c09544 -> 7.0.0.5245.edf66197, which I assume now enforces Vista as minimal Windows version also for all mingw-w64 projects).
Luckily, in Git for Windows' master, we already had changes to require Vista (for unrelated reasons: to restrict the std handle inheritance when spawning new processes).
Technically, Windows Vista is already no longer supported
[https://support.microsoft.com/en-us/help/22882/windows-vista-end-of-support]
, but we do try to keep Git building on older Windows version, up until the point when it becomes too big of a maintenance burden.
Johannes Schindelin (3):
compat/poll: prepare for targeting Windows Vista
mingw: set _WIN32_WINNT explicitly for Git for Windows
mingw: bump the minimum Windows version to Vista
compat/poll/poll.c | 6 +++--- compat/poll/poll.h | 15 +++++++++++++++ config.mak.uname | 4 ---- git-compat-util.h | 4 ++-- 4 files changed, 20 insertions(+), 9 deletions(-)
base-commit: fe8321ec057f9231c26c29b364721568e58040f7
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-44%2Fdscho%2Frequire-windows-vista-or-later-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-44/dscho/require-windows-vista-or-later-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/44
Signature · 1 line
gitgitgadget
PATCH 1/3 compat/poll: prepare for targeting Windows Vista
From: Johannes Schindelin <[email protected]>
Windows Vista (and later) actually have a working poll(), but we still cannot use it because it only works on sockets.
So let's detect when we are targeting Windows Vista and undefine those constants, and define pollfd so that we can declare our own pollfd struct.
We also need to make sure that we override those constants *after* winsock2.h has been #included (otherwise we would not really override those constants).
--- compat/poll/poll.c | 6 +++--- compat/poll/poll.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-)
compat/poll/poll.c +3 -3
@@ -29,9 +29,6 @@#include <sys/types.h> -/* Specification. */ -#include <poll.h> -#include <errno.h> #include <limits.h> #include <assert.h>
@@ -55,6 +52,9 @@# include <unistd.h> #endif +/* Specification. */ +#include "poll.h" +#ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif
compat/poll/poll.h +15 -0
@@ -21,6 +21,21 @@#ifndef _GL_POLL_H#define _GL_POLL_H +#if defined(_WIN32_WINNT) && _WIN32_WINNT >=0x600 +/* Vista has its own, socket-only poll() */ +#undef POLLIN +#undef POLLPRI +#undef POLLOUT +#undef POLLERR +#undef POLLHUP +#undef POLLNVAL +#undef POLLRDNORM +#undef POLLRDBAND +#undef POLLWRNORM +#undef POLLWRBAND +#define pollfd compat_pollfd +#endif +/* fake a poll(2) environment */ #define POLLIN 0x0001/* any readable data available */ #define POLLPRI 0x0002/* OOB/Urgent readable data */
Signature · 1 line
gitgitgadget
PATCH 2/3 mingw: set _WIN32_WINNT explicitly for Git for Windows
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
Previously, we only ever declared a target Windows version if compiling with Visual C.
Which meant that we were relying on the MinGW headers to guess which Windows version we want to target...
Let's be explicit about it, in particular because we actually want to bump the target Windows version to Vista (which we will do in the next commit).
--- git-compat-util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
git-compat-util.h +1 -1
@@ -146,7 +146,7 @@#define _SGI_SOURCE 1#if defined(WIN32 ) && !defined(__CYGWIN__)/* Both MinGW and MSVC */ -# if defined (_MSC_VER) && !defined(_WIN32_WINNT) +# if !defined(_WIN32_WINNT)# define _WIN32_WINNT 0x0502# endif #define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
Signature · 1 line
gitgitgadget
PATCH 3/3 mingw: bump the minimum Windows version to Vista
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
Quite some time ago, a last plea to the XP users out there who want to see Windows XP support in Git for Windows, asking them to get engaged and help, vanished into the depths of the universe.
We tried for a long time to play nice with the last remaining XP users who somehow manage to build Git from source, but a recent update of mingw-w64 (7.0.0.5233.e0c09544 -> 7.0.0.5245.edf66197) finally dropped the last sign of XP support, and Git for Windows' SDK is no longer able to build core Git's master branch as a consequence. (Git for Windows' master branch already bumped the minimum Windows version to Vista a while ago, so it is fine.)
It is time to require Windows Vista or later to build Git from source. This, incidentally, lets us use quite a few nice new APIs.
It also means that we no longer need the inet_pton() and inet_ntop() emulation, which is nice.
--- config.mak.uname | 4 ---- git-compat-util.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-)
config.mak.uname +0 -4
@@ -381,8 +381,6 @@ ifeq ($(uname_S),Windows) NO_PYTHON = YesPlease BLK_SHA1 = YesPlease ETAGS_TARGET = ETAGS - NO_INET_PTON = YesPlease - NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes NATIVE_CRLF = YesPlease DEFAULT_HELP_FORMAT = html
@@ -529,8 +527,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_REGEX = YesPlease NO_PYTHON = YesPlease ETAGS_TARGET = ETAGS - NO_INET_PTON = YesPlease - NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
git-compat-util.h +1 -1
@@ -147,7 +147,7 @@#if defined(WIN32 ) && !defined(__CYGWIN__)/* Both MinGW and MSVC */ # if !defined(_WIN32_WINNT) -# define _WIN32_WINNT 0x0502 +# define _WIN32_WINNT 0x0600# endif #define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ #include <winsock2.h>
Signature · 1 line
gitgitgadget
Re: [PATCH 3/3] mingw: bump the minimum Windows version to Vista
Quoted 12 lines · Johannes Schindelin via GitGitGadget
Quite some time ago, a last plea to the XP users out there who want to see Windows XP support in Git for Windows, asking them to get engaged and help, vanished into the depths of the universe.
We tried for a long time to play nice with the last remaining XP users who somehow manage to build Git from source, but a recent update of mingw-w64 (7.0.0.5233.e0c09544 -> 7.0.0.5245.edf66197) finally dropped the last sign of XP support, and Git for Windows' SDK is no longer able to build core Git's
masterbranch as a consequence. (Git for Windows'masterbranch already bumped the minimum Windows version to Vista a while ago, so it is fine.)
Quoted 5 lines
It is time to require Windows Vista or later to build Git from source. This, incidentally, lets us use quite a few nice new APIs.
It also means that we no longer need the
inet_pton()andinet_ntop()emulation, which is nice.
Earlier in this series you add a:
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
...
#endif
Shouldn't that now be something like:
#if defined(_WIN32_WINNT)
#if _WIN32_WINNT >= 0x600
...
#else
#error "You need at least Windows Vista to build Git!" #endif
#endif
Or do we catch users building on non-supported versions earlier somehow (i.e. not just with a flood of compilation errors).
Quoted 14 lines
config.mak.uname +0
-2@@ -381,8 +381,6 @@ ifeq ($(uname_S),Windows) NO_PYTHON = YesPlease BLK_SHA1 = YesPlease ETAGS_TARGET = ETAGS - NO_INET_PTON = YesPlease - NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes NATIVE_CRLF = YesPlease DEFAULT_HELP_FORMAT = html
config.mak.uname ifneq (,$(findstring MINGW,$(uname_S))) · line 532
Quoted 8 lines
config.mak.uname +0
-2@@ -529,8 +527,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_REGEX = YesPlease NO_PYTHON = YesPlease ETAGS_TARGET = ETAGS - NO_INET_PTON = YesPlease - NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
So before we were defining NO_INET_{PTON,NTOP} because XP needed it, but doing so on all Windows versions, is there other compat stuff there that's just catering to the lowest common denominator, and if so shouldn't that be version checked against the NT version?
Both of the above are just questions I was curious about since I saw your <[email protected]>, and shouldn't bee seen as bumping this to "this needs a re-roll" or it should be delayed in getting to master.
Re: [PATCH 3/3] mingw: bump the minimum Windows version to Vista
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines
It also means that we no longer need the
inet_pton()andinet_ntop()emulation, which is nice.Earlier in this series you add a:
#if
defined(_WIN32_WINNT)&&_WIN32_WINNT>=0x600
...
#endifShouldn't that now be something like:
#if
defined(_WIN32_WINNT)
#if_WIN32_WINNT>=0x600
...
#else
#error "You need at least Windows Vista to build Git!" #endif
#endif
Quoted 2 lines
Or do we catch users building on non-supported versions earlier somehow (i.e. not just with a flood of compilation errors).
That sounds like a reasonable thing to be curious about.
Quoted 4 lines
Both of the above are just questions I was curious about since I saw your <[email protected]>, and shouldn't bee seen as bumping this to "this needs a re-roll" or it should be delayed in getting to master.
Re: [PATCH 3/3] mingw: bump the minimum Windows version to Vista
Hi,
[sorry about the blast from the past, I just noticed that I had not answered]
Quoted 21 lines · Junio C Hamano
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines
It also means that we no longer need the
inet_pton()andinet_ntop()emulation, which is nice.Earlier in this series you add a:
#if
defined(_WIN32_WINNT)&&_WIN32_WINNT>=0x600
...
#endifShouldn't that now be something like:
#if
defined(_WIN32_WINNT)
#if_WIN32_WINNT>=0x600
...
#else
#error "You need at least Windows Vista to build Git!" #endif
#endif
Quoted 4 lines
Quoted 2 lines
Or do we catch users building on non-supported versions earlier somehow (i.e. not just with a flood of compilation errors).
That sounds like a reasonable thing to be curious about.
I specifically wanted to leave the door open for people who might want to put in the effort of keeping Windows XP support alive.
But I guess this does not make any sense anymore, what with Windows _Vista_ being at its end of its life in 3 months.
Thanks! Will prepare a patch,
Dscho
Quoted 6 lines
Quoted 5 lines
Both of the above are just questions I was curious about since I saw your <[email protected]>, and shouldn't bee seen as bumping this to "this needs a re-roll" or it should be delayed in getting to master.
Re: [PATCH 3/3] mingw: bump the minimum Windows version to Vista
Hi,
Quoted 28 lines · Johannes Schindelin
Quoted 21 lines · Junio C Hamano
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines
It also means that we no longer need the
inet_pton()andinet_ntop()emulation, which is nice.Earlier in this series you add a:
#if
defined(_WIN32_WINNT)&&_WIN32_WINNT>=0x600
...
#endifShouldn't that now be something like:
#if
defined(_WIN32_WINNT)
#if_WIN32_WINNT>=0x600
...
#else
#error "You need at least Windows Vista to build Git!" #endif
#endifQuoted 4 lines
Quoted 2 lines
Or do we catch users building on non-supported versions earlier somehow (i.e. not just with a flood of compilation errors).
That sounds like a reasonable thing to be curious about.
Quoted 7 lines
I specifically wanted to leave the door open for people who might want to put in the effort of keeping Windows XP support alive.
But I guess this does not make any sense anymore, what with Windows _Vista_ being at its end of its life in 3 months.
Thanks! Will prepare a patch,
Actually, while preparing that patch, I noticed that this is in the compat/poll/ part of our source code. I'd rather not inflict the Vista-or-later requirement on that part, as it is relatively self-contained and could still be copied into software that does support Windows XP.
Thanks,
Dscho
Re: [PATCH 3/3] mingw: bump the minimum Windows version to Vista
In reply to Ævar Arnfjörð BjarmasonHi Ævar,
[sorry about the blast from the past, I forgot to answer back then.]
Quoted 21 lines · Ævar Arnfjörð Bjarmason
Quoted 19 lines · Johannes Schindelin via GitGitGadget
config.mak.uname +0
-4@@ -381,8 +381,6 @@ ifeq ($(uname_S),Windows) NO_PYTHON = YesPlease BLK_SHA1 = YesPlease ETAGS_TARGET = ETAGS - NO_INET_PTON = YesPlease - NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes NATIVE_CRLF = YesPlease DEFAULT_HELP_FORMAT = html@@ -529,8 +527,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_REGEX = YesPlease NO_PYTHON = YesPlease ETAGS_TARGET = ETAGS - NO_INET_PTON = YesPlease - NO_INET_NTOP = YesPlease
Quoted 8 lines
config.mak.uname ifneq (,$(findstring MINGW,$(uname_S))) · line 532
Quoted 3 lines
config.mak.uname +0
-0NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32So before we were defining NO_INET_{PTON,NTOP} because XP needed it, but doing so on all Windows versions, is there other compat stuff there that's just catering to the lowest common denominator, and if so shouldn't that be version checked against the NT version?
I meant to reply much earlier: When I worked on this, I essentially went through all of the functions that we load dynamically on Windows, and I don't think I found any other pre-Vista support code to get rid of.
Thanks,
Dscho