mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 09:35:38 +00:00
cmake: Detect and log MinGW-w64 version when cross-compiling for Windows #36029
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36029
Loading…
Reference in a new issue
No description provided.
Delete branch "260819-migw-version"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The behaviour of cross-compiled Windows binaries depends heavily on the toolchain components, including MinGW-w64. When the toolchain is not provided by a distro package manager, determining the exact version being used can be difficult.
This PR detects and logs the MinGW-w64 version when cross-compiling for Windows, simplifying debugging when issues like this arise.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.tACK
09cdb3c488Cross-compiled for Windows on Arch Linux and the configure summary reports:
Cross compiling ....................... TRUE, for Windows, x86_64, using MinGW-w64 14.0.0
which matches the mingw-w64 version installed on my system.
ACK
09cdb3c488Seems fine to add, but not sure how often this will actually be useful.
Base:
ff623cfa9bebd3f72041634b94cea2aa3480056cHead:
09cdb3c48872b7a89a70abfaba86830655cc5007Findings
Minor
Incomplete parsing reports a malformed MinGW version (cmake/module/GetMingwVersion.cmake:28, head)
If
_mingw_mac.hexists but a required macro is absent or does not match the exact single-space pattern, that component remains unset, yet this line still exports a version such as12... The caller reports it as detected, contrary to the helper’s documented behavior of leaving the output unset when parsing fails. No checked-in current toolchain header that triggers this condition was identified, so production impact is unconfirmed. Export the version only after all components have been parsed.Header lookup can select another MinGW installation (cmake/module/GetMingwVersion.cmake:13, head)
find_filesearchesCMAKE_PREFIX_PATHinclude locations before the explicitHINTS, so a configured second MinGW prefix containing_mingw_mac.hcan be selected instead of the header in the compiler’s implicit include directories. The depends toolchain preserves existingCMAKE_PREFIX_PATHentries. This can make the configure summary report the wrong MinGW-w64 version; CMake documents this search order. (cmake.org) No checked-in configure invocation supplying a competing MinGW prefix was identified, so production impact is unconfirmed. Restrict the search to the compiler-provided directories, for example by disabling default search paths while retaining these hints.A missing version header leaves an incomplete MinGW status label (CMakeLists.txt:705, head)
When
_mingw_mac.hcannot be found,get_mingw_versionleaves_mingw_versionunset, but this line still appends, using MinGW-w64with no version to the configure summary. Omit the suffix in this case or print an explicit unknown-version marker. No checked-in current supported toolchain missing this header was identified, so production impact is unconfirmed.Full review report
Guix build:
Guix build using an unprivileged guix installation on NixOS:
ACK
09cdb3c488I'm of about the same opinion.
Code seems correct though and not too much maintenance burden. Might help debug things every once in a while :)
Dead code?
It’s unreachable with the current call site. It was meant as a precondition check for the function, to catch misuse if the call site is refactored.