guix: Use UCRT runtime for Windows release binaries #33593

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:251009-guix-ucrt changing 2 files +44 −4
  1. hebasto commented at 9:46 pm on October 9, 2025: member
    This PR switches Windows release binaries to UCRT and resolves one item from #30210.
  2. hebasto added the label Build system on Oct 9, 2025
  3. DrahtBot commented at 9:46 pm on October 9, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33593.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK trevarj
    Concept ACK laanwj

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. in contrib/guix/manifest.scm:128 in f380e62510
    122@@ -123,6 +123,104 @@ desirable for building Bitcoin Core release binaries."
    123   (package-with-extra-patches mingw-w64-x86_64-winpthreads
    124     (search-our-patches "winpthreads-remap-guix-store.patch")))
    125 
    126+
    127+;; While mingw-w64 is packaged in Guix, we maintain our own package,
    128+;; to use UCRT runtime.
    


    maflcko commented at 6:11 am on October 10, 2025:
    Is there a rationale why upstream guix does not offer ucrt?

    hebasto commented at 7:18 am on October 10, 2025:
    1. https://codeberg.org/guix/guix/src/commit/8daae75de3670594dfcb63b6ae6f1603ca6f7971/gnu/packages/mingw.scm#L88-L90:
    0                     ;; XXX: A new target to use UCRT can be introduced as
    1                     ;; the MSYS2 project does, e.g: x86_64-w64-ucrt-mingw32.
    2                     "--with-default-msvcrt=msvcrt")
    
    1. https://issues.guix.gnu.org/71630:

    I’ve added a new configure flag to set the default MSVCRT to MSVCRT as the default now is UCRT. This default is also changed by Debian, other projects like MSYS2 use a different target triplet for UCRT which is now the default and could be introduced if necessary on GNU Guix.

  5. trevarj commented at 7:42 pm on October 21, 2025: none
    I could submit an upstream Guix patch for this. It will help with build times since the package with ucrt will be in the main substitute servers.
  6. laanwj commented at 12:22 pm on October 22, 2025: member
    Concept ACK
  7. fanquake commented at 10:38 am on October 29, 2025: member
    What is the plan for adding CI, as that blocks everything here?
  8. in contrib/guix/manifest.scm:131 in f380e62510 outdated
    122@@ -123,6 +123,104 @@ desirable for building Bitcoin Core release binaries."
    123   (package-with-extra-patches mingw-w64-x86_64-winpthreads
    124     (search-our-patches "winpthreads-remap-guix-store.patch")))
    125 
    126+
    127+;; While mingw-w64 is packaged in Guix, we maintain our own package,
    128+;; to use UCRT runtime.
    129+(define* (make-mingw-w64/implementation machine
    


    fanquake commented at 12:01 pm on October 29, 2025:

    we maintain our own package

    If we are going to copy-paste this from Guix, and maintain it outself, seems like we should simplify it for our usage? i.e we know we are building winpthreads.


    hebasto commented at 1:20 pm on October 29, 2025:
    We cannot phase out the with-winpthreads? argument, as during the recursive invocation it is unset:https://github.com/bitcoin/bitcoin/blob/f380e6251021cc7aa0c47f564147abea922dc050/contrib/guix/manifest.scm#L154-L157

    trevarj commented at 1:20 pm on October 29, 2025:

    It should be possible to inherit the Guix package and then modify arguments to replace `"–with-default-msvcrt=msvcrt" with “”–with-default-msvcrt=ucrt"

     0(use-modules
     1 (guix packages)
     2 (guix gexp)
     3 (guix utils)
     4 (gnu packages mingw)
     5 (srfi srfi-1))
     6
     7(define (override-mingw base-pkg)
     8  (package
     9    (inherit base-pkg)
    10    (name "mingw-ucrt") ; fix this
    11    (arguments
    12     (substitute-keyword-arguments (package-arguments base-pkg)
    13       ((#:configure-flags flags)
    14        #~(cons "--with-default-msvcrt=ucrt" (drop-right #$flags 1)))))))
    15
    16(define-public mingw-x86_64-ucrt (override-mingw mingw-w64-x86_64-winpthreads))
    17(define-public mingw-i686-ucrt (override-mingw mingw-w64-i686-winpthreads))
    

    hebasto commented at 7:51 pm on October 29, 2025:

    @trevarj

    Would it work with the recursion in make-mingw-w64/implementation?


    trevarj commented at 9:28 pm on October 29, 2025:

    Would it work with the recursion in make-mingw-w64/implementation?

    Forgot about that, so no🤦🏻‍♂️. Will be much better when that PR lands. (See below)


    trevarj commented at 5:32 am on October 30, 2025:

    @hebasto This builds correctly with guix build -f [save below to tmp file]. The native-inputs override solves the issue with recursion.

     0(use-modules
     1 (guix packages)
     2 (guix gexp)
     3 (guix utils)
     4 (guix build-system gnu)
     5 (gnu packages mingw))
     6
     7(define (override-msvcrt pkg)
     8  (package
     9    (inherit pkg)
    10    (name (string-append (package-name pkg) "-ucrt"))
    11    (arguments
    12     (substitute-keyword-arguments (package-arguments pkg)
    13       ((#:configure-flags flags)
    14        #~(map (lambda (flag)
    15                 (if (string-prefix? "--with-default-msvcrt" flag)
    16                     "--with-default-msvcrt=ucrt"
    17                     flag))
    18               #$flags))))))
    19
    20(define (make-mingw-ucrt winpthreads-pkg sans-pkg)
    21  (override-msvcrt
    22   (package
    23     (inherit winpthreads-pkg)
    24     (native-inputs
    25      (modify-inputs (package-native-inputs winpthreads-pkg)
    26        (replace "xlibc" (override-msvcrt sans-pkg)))))))
    27
    28(define-public mingw-x86_64-ucrt
    29  (make-mingw-ucrt mingw-w64-x86_64-winpthreads mingw-w64-x86_64-sans-winpthreads))
    30
    31(define-public mingw-i686-ucrt
    32  (make-mingw-ucrt mingw-w64-i686-winpthreads mingw-w64-i686-sans-winpthreads))
    33
    34mingw-x86_64-ucrt
    
    0successfully built /gnu/store/97knb394q69xs0swb9imax4zqfc8vhnb-mingw-w64-x86_64-winpthreads-ucrt-13.0.0.drv
    1/gnu/store/y5w87r0sj59c7ga23r69ln4mvy4ibff9-mingw-w64-x86_64-winpthreads-ucrt-13.0.0
    

    hebasto commented at 11:04 pm on November 4, 2025:
    Thanks! Reworked.
  9. in contrib/guix/manifest.scm:141 in f380e62510
    136+specified, recurse and return a mingw-w64 with support for winpthreads."
    137+  (let* ((triplet (string-append machine "-" "w64-mingw32")))
    138+    (package
    139+      (name (string-append "mingw-w64" "-" machine
    140+                           (if with-winpthreads? "-winpthreads" "")))
    141+      (version "12.0.0")
    


    fanquake commented at 12:02 pm on October 29, 2025:
    Any reason to not use the v13.0.0 headers: https://www.mingw-w64.org/changelog/?
  10. hebasto force-pushed on Oct 29, 2025
  11. hebasto commented at 10:10 pm on October 29, 2025: member

    Rebased. Some of the feedback has been addressed.

    My Guix build:

    0x86_64
    1366c53942430c0f310fc42445693e7ba1ff5dce25f2df8e42d3c4b044747f385  guix-build-4d31ddc6dfe6/output/dist-archive/bitcoin-4d31ddc6dfe6.tar.gz
    21b0c2e70c8f85650a4b4238c74dd22b960b2f4036042d2f8c6b302dbc50ae3b7  guix-build-4d31ddc6dfe6/output/x86_64-w64-mingw32/SHA256SUMS.part
    3ed292458da2126949ee0a35495ba59272066364d7b458b28576dcd229ed984b5  guix-build-4d31ddc6dfe6/output/x86_64-w64-mingw32/bitcoin-4d31ddc6dfe6-win64-codesigning.tar.gz
    49cf21d10a8c63edd81f43360dd39b0f38c38fc7ac632b96243838c980fd8abe2  guix-build-4d31ddc6dfe6/output/x86_64-w64-mingw32/bitcoin-4d31ddc6dfe6-win64-debug.zip
    57e402681080ca6e0e4c5c8c9113bc3c6f9ac2a0f878a8e253c9c8a91756cf065  guix-build-4d31ddc6dfe6/output/x86_64-w64-mingw32/bitcoin-4d31ddc6dfe6-win64-setup-unsigned.exe
    6feaa36c5edf9b9e30bd2e1c3523d2f1b445cb6bf96c40a87c250c37343d8d6bd  guix-build-4d31ddc6dfe6/output/x86_64-w64-mingw32/bitcoin-4d31ddc6dfe6-win64-unsigned.zip
    
  12. hebasto marked this as ready for review on Oct 29, 2025
  13. hebasto added the label Windows on Oct 29, 2025
  14. fanquake changes_requested
  15. fanquake commented at 10:28 am on October 30, 2025: member
    What is the plan for adding CI, as that blocks everything here?
  16. hebasto commented at 1:41 pm on October 30, 2025: member

    What is the plan for adding CI, as that blocks everything here?

    I’m working on it. I have issues with the sqlite package that are not reproducible neither in the nightly builds nor locally.

    UPDATE. See #33764.

  17. guix: Use UCRT runtime for Windows release binaries
    Co-authored-by: Trevor Arjeski <tmarjeski@gmail.com>
    dbb835956a
  18. hebasto force-pushed on Nov 4, 2025
  19. hebasto commented at 11:03 pm on November 4, 2025: member
    Reworked per feedback from @trevarj.
  20. hebasto commented at 11:22 pm on November 4, 2025: member

    My Guix build:

    0aarch64
    14e80325f9cba1c286a999eeaa6fb5f06bb56ba03f118cfb6eaa86c8443318ccc  guix-build-dbb835956abf/output/dist-archive/bitcoin-dbb835956abf.tar.gz
    27557b85092d69ac4f6ebeb4881a41fe808ee684b1b2f87efde97a616f1d1b213  guix-build-dbb835956abf/output/x86_64-w64-mingw32/SHA256SUMS.part
    33cf561ff53f83f822fd451b2f83161908daad89598d286de916a641640abe747  guix-build-dbb835956abf/output/x86_64-w64-mingw32/bitcoin-dbb835956abf-win64-codesigning.tar.gz
    4f607587780890278ffcc9c4b346bcecc9998951d99fb6d3e8a075c5f2ad76cc6  guix-build-dbb835956abf/output/x86_64-w64-mingw32/bitcoin-dbb835956abf-win64-debug.zip
    5dd5c910c4a46b1fba7fe2dd3c1747c99cd23d24c832768b3d7abc2c3a3aa7598  guix-build-dbb835956abf/output/x86_64-w64-mingw32/bitcoin-dbb835956abf-win64-setup-unsigned.exe
    62c9f04917c10cf52151aeac6276f94c6b3229d80ca72ee980c987282cd26a471  guix-build-dbb835956abf/output/x86_64-w64-mingw32/bitcoin-dbb835956abf-win64-unsigned.zip
    
  21. trevarj commented at 5:30 am on November 5, 2025: none

    @hebasto thanks for working in my suggestion!

    ACK dbb8359

  22. DrahtBot requested review from laanwj on Nov 5, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-06 09:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me