Skip to content
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

build: Set minimum required Windows version to Windows 7 #5204

Merged
merged 15 commits into from
Jun 5, 2021

Conversation

ken2812221 and others added 14 commits June 5, 2021 14:47
Also remove all defines in many places and define it in configure stage to keep consistency.

(cherry picked from commit 1bd9ffd)
"The AI_ADDRCONFIG flag is defined on the Windows SDK for Windows Vista
and later. The AI_ADDRCONFIG flag is supported on Windows Vista and
later."
https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo

However, the version of MinGW we use on Travis is not current and does
not carry the relevant definition, as such I defined it in compat.
https://github.com/wine-mirror/wine/blob/master/include/ws2tcpip.h

Testing confirms that the PROTECTION_LEVEL_UNRESTRICTED,
IPV6_PROTECTION_LEVEL, PROCESS_DEP_ENABLE, AI_ADDRCONFIG, are now
supported by the version of Windows that we test against, so can be
removed.
https://travis-ci.org/bitcoin/bitcoin/jobs/483255439
https://travis-ci.org/Empact/bitcoin/jobs/484123087

(cherry picked from commit d0522ec)
We no longer build/ship 32 bit windows executables.

(cherry picked from commit abc147d)
While cross compiling, HOST=x86_64-w64-mingw32, none of these
libs actually seem to be passed to the linker.

(cherry picked from commit 2525c09)
This flag was used when building 32-bit Windows executables, which we no-longer
do, and is not accepted by the linker for any of the hosts we currently build
for. i.e:

```bash
checking whether the linker accepts -Wl,--large-address-aware... no
```

--large-address-aware
    If given, the appropriate bit in the "Characteristics" field of the COFF
    header is set to indicate that this executable supports virtual addresses
    greater than 2 gigabytes. This should be used in conjunction with the /3GB
    or /USERVA=value megabytes switch in the "[operating systems]" section of
    the BOOT .INI. Otherwise, this bit has no effect. [This option is specific
    to PE targeted ports of the linker]

You can check that the appropriate bit in the COFF header of our current
Windows binaries is still be set using dumpbin. i.e:

```powershell
dumpbin /headers .\bitcoind.exe

FILE HEADER VALUES
<snip>
26 characteristics
     Executable
     Line numbers stripped
     Application can handle large (>2GB) addresses
```

(cherry picked from commit acd644b)
This has been around since the introduction of autotools. However at
this point I'm not sure we'd every want to suppress all warnings when
performing a build, and given that CXX FLAGS will have been overriden
when cross-compiling for Windows (using depends), this would rarely,
if-ever be used anyways.

From https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html:
-w

    Inhibit all warning messages.

(cherry picked from commit 89fea68)
Instruct the linker to set the major & minor subsystem versions in the PE
header to 6 & 1 (NT 6.1 which corresponds to Windows 7). Similar to
macOS, the binary will now refuse to run on unsupported versions of
Windows.

(cherry picked from commit e8a8cff)
libevent uses getaddrinfo when available, and falls back to gethostbyname
Windows has both, but gethostbyname only supports IPv4
libevent fails to detect Windows's getaddrinfo due to not including the right headers
This patches libevent's configure script to check it correctly

(cherry picked from commit 03e056e)
This enables of the use of AI_* definitions in the Windows headers,
specifically AI_ADDRCONFIG, which fixes an issue with libevent and
ipv6 on Windows.

It also aligns with what we define in configure when building Core.

(cherry picked from commit eb6b735)
common.vcxproj used for MSVC builds

(cherry picked from commit 1ccb9f3)
This fixes a linker issue now that the minimum Windows version is
Windows 7, and dependencies now try to use BCryptGenRandom.
@str4d str4d added A-build Area: Build system O-windows Operating system: Windows labels Jun 5, 2021
@str4d str4d added this to the Core Sprint 2021-20 milestone Jun 5, 2021
@str4d str4d requested a review from daira June 5, 2021 14:45
doc/release-notes.md Outdated Show resolved Hide resolved
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This builds for me with the following warnings (not sure they are due to this PR; I think I've seen them before):

lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_uncaught_exceptions (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_decrement_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_increment_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_current_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_rethrow_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_uncaught_exceptions (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_decrement_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_increment_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_current_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_rethrow_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_uncaught_exceptions (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_decrement_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_increment_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_current_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_rethrow_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_uncaught_exceptions (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_decrement_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_increment_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_current_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_rethrow_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: gtest/zcash_gtest-test_checktransaction.o: locally defined symbol imported: __cxa_demangle (defined in libc++abi.a(cxa_demangle.cpp.obj)) [LNK4217]
lld-link: warning: gtest/zcash_gtest-test_zip32.o: locally defined symbol imported: __cxa_demangle (defined in libc++abi.a(cxa_demangle.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_uncaught_exceptions (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_decrement_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_increment_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_current_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_rethrow_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_uncaught_exceptions (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_decrement_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_increment_exception_refcount (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_current_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libc++.a(exception.cpp.obj): locally defined symbol imported: __cxa_rethrow_primary_exception (defined in libc++abi.a(cxa_exception.cpp.obj)) [LNK4217]
lld-link: warning: libboost_unit_test_framework.a(execution_monitor.obj): locally defined symbol imported: __cxa_demangle (defined in libc++abi.a(cxa_demangle.cpp.obj)) [LNK4217]```

LNK4217 is https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-warning-lnk4217?view=msvc-160 , which doesn't seem critical.

doc/release-notes.md Outdated Show resolved Hide resolved
@str4d
Copy link
Contributor Author

str4d commented Jun 5, 2021

Yep, those warnings were there before this PR.

@zkbot r+

@zkbot
Copy link
Contributor

zkbot commented Jun 5, 2021

📌 Commit 8936cfe has been approved by str4d

@zkbot
Copy link
Contributor

zkbot commented Jun 5, 2021

⌛ Testing commit 8936cfe with merge 372f695d4d027cf20b6fb60088ab24faac7e442f...

@daira
Copy link
Contributor

daira commented Jun 5, 2021

I'm trying something to get rid of the link warnings (but that can be a separate PR, if it works).

@str4d
Copy link
Contributor Author

str4d commented Jun 5, 2021

CI has passed for all required builders, and this PR would have merged several hours ago, but for a bug in CI that is causing it to hang on two non-required builders. I'm clicking the merge button.

@str4d str4d merged commit 5869a48 into zcash:master Jun 5, 2021
@str4d str4d deleted the win-7 branch June 5, 2021 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build Area: Build system O-windows Operating system: Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants