build: check for SetThreadDescription() at configure time #36057

pull ViniciusCestarii wants to merge 1 commits into bitcoin:master from ViniciusCestarii:guard-name-windows-os-thread changing 3 files +11 −2
  1. ViniciusCestarii commented at 2:14 PM on August 22, 2026: contributor

    SetThreadDescription() is missing from mingw-w64 headers before 12.0.0, so the Windows cross-compile fails on distro toolchains, e.g. Ubuntu 24.04. Reported by hebasto in #35884 (comment).

    Check for the symbol at configure time and guard its use with a new HAVE_SETTHREADDESCRIPTION guard, as cmake/introspection.cmake already does for other optional symbols. This avoids having to declare a minimum mingw-w64 version: toolchains that have the symbol get OS-level thread names, older ones build fine without them.

  2. DrahtBot added the label Build system on Aug 22, 2026
  3. DrahtBot commented at 2:14 PM on August 22, 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/36057.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK fanquake, 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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. maflcko commented at 2:24 PM on August 22, 2026: member

    Seems fine. An alternative would be to document the minimum required version (fac0aa7799f96c615fe361dff1a01531f741a9b5):

    diff --git a/doc/build-windows.md b/doc/build-windows.md
    index 0af73681d8..c47359cea3 100644
    --- a/doc/build-windows.md
    +++ b/doc/build-windows.md
    @@ -17,2 +17,3 @@ The instructions below work on Ubuntu and Debian. Make sure the distribution's `
     package meets the minimum required GCC version specified in [dependencies.md](dependencies.md).
    +At least Mingw version 12.0 is required.
     If compiling with the GUI (default in depends), at least GCC version 13 is required.
    
  5. maflcko added this to the milestone 32.0 on Aug 22, 2026
  6. hebasto commented at 2:40 PM on August 22, 2026: member

    Seems fine. An alternative would be to document the minimum required version (fac0aa7):

    diff --git a/doc/build-windows.md b/doc/build-windows.md
    index 0af73681d8..c47359cea3 100644
    --- a/doc/build-windows.md
    +++ b/doc/build-windows.md
    @@ -17,2 +17,3 @@ The instructions below work on Ubuntu and Debian. Make sure the distribution's `
     package meets the minimum required GCC version specified in [dependencies.md](dependencies.md).
    +At least Mingw version 12.0 is required.
     If compiling with the GUI (default in depends), at least GCC version 13 is required.
    

    I think it would be good to document the minimum required version regardless of whether we check for symbol availability. Setting it to 12.0 seems fine to me.

  7. maflcko commented at 2:47 PM on August 22, 2026: member

    Hmm, if it is set to 12, then we don't really need the changes here?

    No strong opinion, but maybe do the changes here for 32.x and then remove them again and bump mingw to 13 for 33.x, as that is required for the next QT bump and libmultiprocess+Windows anyway?

  8. hebasto commented at 2:53 PM on August 22, 2026: member

    No strong opinion, but maybe do the changes here for 32.x and then remove them again and bump mingw to 13 for 33.x, as that is required for the next QT bump and libmultiprocess+Windows anyway?

    I agree. @ViniciusCestarii Please add documenting commit.

  9. hebasto commented at 2:55 PM on August 22, 2026: member

    And please consider the related #36029.

  10. ViniciusCestarii commented at 7:34 PM on August 22, 2026: contributor

    Pushed ecb5bf8400686183c40731da19dd3c9e46bb7c19 documenting the minimum required Mingw-w64 version.

  11. hebasto commented at 9:51 AM on August 24, 2026: member

    Hmm, if it is set to 12, then we don't really need the changes here?

    I do apologise for the confusion I caused. Indeed, only one of the two commits is needed.

  12. ViniciusCestarii force-pushed on Aug 24, 2026
  13. ViniciusCestarii commented at 12:33 PM on August 24, 2026: contributor

    Forced push fd4e1636ed1a4d691c2a345b9881cd88f8b31fa7 removing the minimum required Mingw-w64 version from docs. Better to enforce Mingw-w64 minimum version with the next QT bump and libmultiprocess+Windows as justification than only named Windows threads.

  14. hebasto approved
  15. hebasto commented at 2:22 PM on August 24, 2026: member

    ACK fd4e1636ed1a4d691c2a345b9881cd88f8b31fa7. Tested here.

  16. in cmake/introspection.cmake:81 in fd4e1636ed
      75 | @@ -76,6 +76,12 @@ check_cxx_source_compiles("
      76 |    " HAVE_STRONG_GETAUXVAL
      77 |  )
      78 |  
      79 | +# Check for SetThreadDescription(), which is missing from mingw-w64 headers
      80 | +# before 12.0.0.
      81 | +if(WIN32)
    


    fanquake commented at 2:27 PM on August 24, 2026:

    This doesn't need to be gated on WIN32.


    ViniciusCestarii commented at 4:45 PM on August 26, 2026:

    true, thanks. Done on bed46bd16c2b34eec62849b96cebbbdbcdd2c1ac

  17. fanquake commented at 3:09 PM on August 24, 2026: member

    Looking at this further. #32380 changed our minimum supported/tested Windows version to Windows 10 (version 1903), and SetThreadDescription has been available since Windows 10, version 1607. Devs should be free to use any functions available in a version earlier than 1903, without having to check for availability. So it seems like the mingw-w64 requirements were missing from #32380, or we are still trying to support a version of mingw-w64 which isn't compatible with our minimum version requirements?

  18. fanquake commented at 1:20 PM on August 26, 2026: member

    @hebasto can you followup here in regards to #32380, and what our minimum supported build/runtime Windows versions already are?

  19. maflcko commented at 1:43 PM on August 26, 2026: member

    I think it is fine to have this check for 32.x. A larger sweep+bump can happen in 33.x

  20. hebasto commented at 1:49 PM on August 26, 2026: member

    Looking at this further. #32380 changed our minimum supported/tested Windows version to Windows 10 (version 1903), and SetThreadDescription has been available since Windows 10, version 1607. Devs should be free to use any functions available in a version earlier than 1903, without having to check for availability. So it seems like the mingw-w64 requirements were missing from #32380...

    I concur. Indeed, #32380 implicitly set the minimum required mingw-w64 version to 12.0.

    or we are still trying to support a version of mingw-w64 which isn't compatible with our minimum version requirements?

    No, I don't think we should.

  21. build: check for SetThreadDescription() at configure time bed46bd16c
  22. ViniciusCestarii force-pushed on Aug 26, 2026
  23. ViniciusCestarii commented at 4:48 PM on August 26, 2026: contributor

    Thanks for the reviews. Forced push bed46bd16c2b34eec62849b96cebbbdbcdd2c1ac dropping the unnecessary check for WIN on introspection.cmake, addressing #36057 (review)

  24. fanquake commented at 2:50 PM on August 27, 2026: member

    utACK bed46bd16c2b34eec62849b96cebbbdbcdd2c1ac - could be reverted + docs updated post branch-off.

  25. DrahtBot requested review from hebasto on Aug 27, 2026
  26. hebasto approved
  27. hebasto commented at 10:10 PM on August 27, 2026: member

    re-ACK bed46bd16c2b34eec62849b96cebbbdbcdd2c1ac.

  28. hebasto merged this on Aug 27, 2026
  29. hebasto closed this on Aug 27, 2026

  30. maflcko commented at 8:22 AM on August 28, 2026: member

    So I guess there could be a new pull request (with a target of the next 33.x milestone), which:


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-31 18:51 UTC

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