From 93a83c81f04cffc149e5048bd43f0a627e1cf700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 9 Jan 2017 12:10:25 +0100 Subject: [PATCH] Windows: Workaround missing includes in MinGW-w64 < 4 The MinGW-w64 version we have on our Travis build environment (Ubuntu 12.04, mingw-w64 2.0.1, gcc 4.6) is old and has some missing includes in the dependencies of the `tcpmib.h` header [0] [1] [2]. Those were not triggered before 6323779596dea0db7f58afef7d3d3d5588ef20cb probably due to conflicting WINVER definitions which prevented triggering the code specific to >= 0x0600 (Vista). We ensure it won't be triggered by defining the _WIN32_WINNT macro to Windows XP compatibility. (cherry picked from commit b24fe6879a2d26b530c1198ba7abb8cf2719f06c) --- drivers/unix/ip_unix.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index ed11c0686dc..0e8e5f0095a 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -42,7 +42,19 @@ #include #include #ifndef WINRT_ENABLED - #include + #if defined(__MINGW32__ ) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 4) + // MinGW-w64 on Ubuntu 12.04 (our Travis build env) has bugs in this code where + // some includes are missing in dependencies of iphlpapi.h for WINVER >= 0x0600 (Vista). + // We don't use this Vista code for now, so working it around by disabling it. + // MinGW-w64 >= 4.0 seems to be better judging by its headers. + #undef _WIN32_WINNT + #define _WIN32_WINNT 0x0501 // Windows XP, disable Vista API + #include + #undef _WIN32_WINNT + #define _WIN32_WINNT 0x0600 // Reenable Vista API + #else + #include + #endif // MINGW hack #endif #else #include