build: ci/doc win64-cross build via nix #35877

pull maflcko wants to merge 2 commits into bitcoin:master from maflcko:2608-build-win64-cross changing 8 files +74 −8
  1. maflcko commented at 11:38 AM on August 4, 2026: member

    Release cross-builds to win64 are done in guix. There are also docs to use Debian/Ubuntu for those cross-builds and this approach is used in CI. However, there are many problems:

    So add a way to use nix to do the cross build. This allows to closer mimic the guix build.

    Also, clarify that cygwin/msys2 are not tested/supported.

  2. DrahtBot renamed this:
    build: ci/doc win64-cross build via nix
    build: ci/doc win64-cross build via nix
    on Aug 4, 2026
  3. DrahtBot added the label Build system on Aug 4, 2026
  4. DrahtBot commented at 11:38 AM on August 4, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK willcl-ark, hebasto

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #32162 (depends: Switch from multilib to platform-specific toolchains by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot added the label CI failed on Aug 4, 2026
  6. maflcko marked this as a draft on Aug 4, 2026
  7. DrahtBot removed the label CI failed on Aug 4, 2026
  8. maflcko commented at 2:35 PM on August 4, 2026: member

    Extracted the unrelated bugfix to #35879, but CI is green here and Concept (N)ACKs or questions can be dropped.

  9. in contrib/devtools/shell-win64-cross.nix:2 in fa48e317f3
       0 | @@ -0,0 +1,40 @@
       1 | +{ pkgs ? import (builtins.fetchTarball {
       2 | +    url = "https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-26.05.tar.gz";
    


    willcl-ark commented at 12:11 PM on August 6, 2026:

    In fa48e317f3045697da72e0c888f550d5a4c5e024

    Are we happy to use the rolling HEAD release here? I guess its ~ analagous to apt install x bumping versions occasionally, but we can of course pin too :)

    edit: left other comments about caching which may contribute to us preferring to pin here.


    maflcko commented at 2:50 PM on August 6, 2026:

    Yeah, a pin makes sense here. Especially if this is ever switched to the unstable channel in the future, a pin would be even be required then.

  10. in contrib/devtools/shell-win64-cross.nix:12 in fa48e317f3
       7 | +  crossPkgs = if host == "x86_64-w64-mingw32ucrt"
       8 | +    then pkgs.pkgsCross.ucrt64
       9 | +    else if host == "x86_64-w64-mingw32"
      10 | +      then pkgs.pkgsCross.mingwW64
      11 | +      else throw "Unsupported HOST: ${host}";
      12 | +  toolchain = "x86_64-w64-mingw32";
    


    willcl-ark commented at 12:21 PM on August 6, 2026:

    In fa48e317f3045697da72e0c888f550d5a4c5e024

    I wonder if we can derive this more safely/dynamically using toolchain = crossPkgs.stdenv.cc.targetPrefix; (which comes with trailing dash -)? Currently it's fixed the same for both crossPkg sets so make no difference though.


    maflcko commented at 2:50 PM on August 6, 2026:

    thx, done

  11. in contrib/devtools/shell-win64-cross.nix:18 in fa48e317f3 outdated
      13 | +  pthreads = crossPkgs.windows.pthreads;
      14 | +in
      15 | +
      16 | +pkgs.mkShellNoCC {
      17 | +  packages = [
      18 | +    crossPkgs.gcc14
    


    willcl-ark commented at 2:02 PM on August 6, 2026:

    In fa48e317f3045697da72e0c888f550d5a4c5e024

    I am not sure/convinced that these cross packages are cached regularly (or at all?) on cache.nixos.org:

    instatiating (one of) the shell(s) first time shows:

    bitcoin/worktrees/pr-35877 on  pr-35877 [$] via △ v4.1.2 via 🐍 v3.14.6 via ❄️  impure (nix-shell-env)
    ❯ HOST=x86_64-w64-mingw32ucrt \
            nix-instantiate contrib/devtools/shell-win64-cross.nix > shell.drv
    unpacking 'https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-26.05.tar.gz' into the Git cache...
    ^[rwarning: you did not specify '--add-root'; the result might be removed by the garbage collector
    
    bitcoin/worktrees/pr-35877 on  pr-35877 [$!?] via △ v4.1.2 via 🐍 v3.14.6 via ❄️  impure (nix-shell-env) took 16s
    ❯ nix-store --realise --dry-run "$(cat shell.drv)"
    these 14 derivations will be built:
      /nix/store/0px7k59nich0bsnvjakhxjq9x93l3mkl-x86_64-w64-mingw32-nolibc-gcc-15.2.0.drv
      /nix/store/x9pbpqsnk1wc2x0fb7ld7q46g7rhanl1-win-dll-hook.sh.drv
      /nix/store/l3yi6dp8qcfq7yg352mfgb1m53hxkba3-x86_64-w64-mingw32-nolibc-gcc-wrapper-15.2.0.drv
      /nix/store/2pnpr58w1w4b9n3104al5dsglh1lgn2k-stdenv-linux.drv
      /nix/store/kviifb5frqrmfr4q17j473wvk2lz934w-mingw-w64-x86_64-w64-mingw32-13.0.0.drv
      /nix/store/533n2nw3bykqiq19r1y3j23hysh5fcrg-x86_64-w64-mingw32-binutils-wrapper-2.46.drv
      /nix/store/mvb6why48wvi4480sqnlqg63fdwm50lx-x86_64-w64-mingw32-nolibc-gcc-wrapper-15.2.0.drv
      /nix/store/xsysspl58chfqp0ccaabjxaykwg5g3jf-stdenv-linux.drv
      /nix/store/mrkwyp8z098n9xg26h2q7rsyjnai2mss-mcfgthread-x86_64-w64-mingw32-2.3.2.drv
      /nix/store/44qzqs3m23py3rlinh6y14qj61dqwdk5-x86_64-w64-mingw32-gcc-14.3.0.drv
      /nix/store/9pijjdxc2kmas8idahdlqzkdvqk0ckqv-win-dll-hook.sh.drv
      /nix/store/jz9z9gxkfmiwqbikxg2fv7rqxyql2aj6-x86_64-w64-mingw32-gcc-wrapper-14.3.0.drv
      /nix/store/kp9j507wb6vhgx8k72644q41i10l5p23-mingw_w64-pthreads-x86_64-w64-mingw32-13.0.0.drv
      /nix/store/2hrpww4d9j4q9bacwd9pbbdfs04hrpdy-nix-shell.drv
    

    These should be caught in the docker buildkit layer cache naively, but any miss there in base_install.sh or earlier will cause a rebuild of the above, I think.

    We may therefore want to consider a combination of pinning the nixpkgs commit, and using cachix (docs) or similar to cache built packages on pushes to master.

    Noting that this is another "account" for someone to manage and another repo secret needed, but probably worth it IMO. The cachix cache woudl also be readable for developers to use themselves, if they add the cachix cache alongside cache.nixos.org


    willcl-ark commented at 2:05 PM on August 6, 2026:

    The CI logs seem to confirm this:

    [#12](/bitcoin-bitcoin/12/) 26.73 + [[ x86_64-w64-mingw32ucrt == x86_64-w64-mingw32* ]]
    [#12](/bitcoin-bitcoin/12/) 26.73 + NIX_BUILD_SHELL=bash
    [#12](/bitcoin-bitcoin/12/) 26.73 + nix-shell /home/runner/work/_temp/contrib/devtools/shell-win64-cross.nix --run true
    [#12](/bitcoin-bitcoin/12/) 26.75 unpacking 'https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-26.05.tar.gz' into the Git cache...
    [#12](/bitcoin-bitcoin/12/) 45.86 these 16 derivations will be built:
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/w834ly4r33imkb5v2cy2m4qvs5gax3jw-mingw_w64-headers-13.0.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/77pphppxzw9lr4yn332nkiqrmncjp1aj-x86_64-w64-mingw32-binutils-wrapper-2.46.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/0px7k59nich0bsnvjakhxjq9x93l3mkl-x86_64-w64-mingw32-nolibc-gcc-15.2.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/x9pbpqsnk1wc2x0fb7ld7q46g7rhanl1-win-dll-hook.sh.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/l3yi6dp8qcfq7yg352mfgb1m53hxkba3-x86_64-w64-mingw32-nolibc-gcc-wrapper-15.2.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/2pnpr58w1w4b9n3104al5dsglh1lgn2k-stdenv-linux.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/kviifb5frqrmfr4q17j473wvk2lz934w-mingw-w64-x86_64-w64-mingw32-13.0.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/533n2nw3bykqiq19r1y3j23hysh5fcrg-x86_64-w64-mingw32-binutils-wrapper-2.46.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/mvb6why48wvi4480sqnlqg63fdwm50lx-x86_64-w64-mingw32-nolibc-gcc-wrapper-15.2.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/xsysspl58chfqp0ccaabjxaykwg5g3jf-stdenv-linux.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/zn0zj4g3bscs2cm458zajhypa3c5d07z-dlltool.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/mrkwyp8z098n9xg26h2q7rsyjnai2mss-mcfgthread-x86_64-w64-mingw32-2.3.2.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/44qzqs3m23py3rlinh6y14qj61dqwdk5-x86_64-w64-mingw32-gcc-14.3.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/9pijjdxc2kmas8idahdlqzkdvqk0ckqv-win-dll-hook.sh.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/jz9z9gxkfmiwqbikxg2fv7rqxyql2aj6-x86_64-w64-mingw32-gcc-wrapper-14.3.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86   /nix/store/kp9j507wb6vhgx8k72644q41i10l5p23-mingw_w64-pthreads-x86_64-w64-mingw32-13.0.0.drv
    [#12](/bitcoin-bitcoin/12/) 45.86 these 168 paths will be fetched (723.6 MiB download, 1.9 GiB unpacked):
    

    Also noting that this adds 1.9GB to the docker image as configured.


    willcl-ark commented at 2:12 PM on August 6, 2026:

    Finally, it is possible that these do get cached on cache.nixos.org (I just don't know how to check), but the hydra server which builds them lags behind. I suspect these aren't being built though, as building all cross-combinations would be too expensive.


    maflcko commented at 2:50 PM on August 6, 2026:

    Hmm, I think storage is cheap, so I think this is good enough for now. Also, I probably won't be able to run a cachix for this, but maybe foo.fish can, if other reviewers think it is overall worth it?

    But I think for now it seems fine to eat the 1.9 GB twice.

  12. willcl-ark commented at 2:18 PM on August 6, 2026: member

    Concept ACK

    Happy to see a little nix sneaking its way in, and seems like a sensible enough solution to me.

    Left a few comments inline for you consideration.

  13. DrahtBot added the label CI failed on Aug 6, 2026
  14. maflcko force-pushed on Aug 7, 2026
  15. DrahtBot removed the label CI failed on Aug 7, 2026
  16. doc: Clarify that cygwin/msys2 are not tested/supported fac27bc971
  17. maflcko marked this as ready for review on Aug 7, 2026
  18. build: ci/doc win64-cross build via nix fa5021fe9b
  19. maflcko force-pushed on Aug 7, 2026
  20. hebasto commented at 11:27 AM on August 7, 2026: member

    Concept ACK.

  21. hebasto commented at 11:49 AM on August 7, 2026: member

    It's not possible now to verify that UCRT is being used from the following configure summary line:

    C++ compiler .......................... GNU 14.3.0, /nix/store/j1v9zdbf0l4qfvwybb90qwzyh1lmxfw1-x86_64-w64-mingw32-gcc-wrapper-14.3.0/bin/x86_64-w64-mingw32-g++
    

    Could we run dumpbin.exe /imports ... in test jobs to ensure the correct runtime is being linked?

  22. maflcko commented at 12:27 PM on August 7, 2026: member

    I've confirmed that locally in the container, but I don't have Windows to check there. Mind creating a separate ci-only pull for this? It seems useful on current master, even without this pull?

  23. hebasto commented at 2:52 PM on August 7, 2026: member

    Mind creating a separate ci-only pull for this? It seems useful on current master, even without this pull?

    Sure. Done in #35931.


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: 2026-08-10 21:51 UTC

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