fix: support building with MinGW on Windows 7#1120
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1120 +/- ##
==========================================
- Coverage 95.80% 92.71% -3.09%
==========================================
Files 61 71 +10
Lines 8143 10248 +2105
Branches 0 10248 +10248
==========================================
+ Hits 7801 9501 +1700
- Misses 342 451 +109
- Partials 0 296 +296 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
samuel40791765
approved these changes
May 11, 2026
dougch
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues:
Addresses:
Description of changes:
Enable
x86_64-win7-windows-gnu(and similar win7 MinGW triples) to build and run on Windows 7 by routingCRYPTO_sysrandthroughBCryptGenRandominstead ofProcessPrng.The upstream C source (
crypto/rand_extra/windows.c) guards the Win7-compatible code path with!defined(__MINGW32__), so MinGW builds always take theProcessPrngpath — which aborts on Windows 7 because that API only exists on Windows 8+. This change works around the guard by definingAWSLC_WINDOWS_7_COMPATdirectly from the build script for win7-gnu targets, and explicitly linksbcrypt(since MinGW ignores the MSVC#pragma comment(lib, ...)in the source).Call-outs:
This is a temporary workaround. The proper fix is aws/aws-lc#3239, which drops the
!defined(__MINGW32__)guard upstream. Once that merges and we bump the submodule, theAWSLC_WINDOWS_7_COMPATdefine can be removed. The_WIN32_WINNTandbcryptlink will still be needed for the CC builder path.The existing win7-msvc handling was refactored into the same
if target().contains("-win7-windows-")block so both toolchains share the_WIN32_WINNT=0x0601define in one place.Testing:
Build-tested with
cargo check -p aws-lc-sys. Full validation requires a MinGW cross-compile targetingx86_64-win7-windows-gnu, which will be exercised once the upstream fix and a CI job are in place.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.