cmake: Fix FindQt module #32709

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:250609-cmake-findqt changing 1 files +12 −3
  1. hebasto commented at 11:34 am on June 9, 2025: member

    This PR improves the FindQt module in two ways:

    1. Ensures that the find_package(Qt .. MODULE REQUIRED COMPONENTS ...) call treats any missing component as a fatal error. In the master branch, only a warning is currently issued.

    2. Cleans up the user-facing part of the CMake cache following the migration to Qt 6. An exception (Qt6_DIR) is documented.

  2. cmake: Fix `FindQt` module
    The `find_package(Qt .. MODULE REQUIRED COMPONENTS ...)` call must treat
    any missing component as a fatal error.
    8f1b55d1d5
  3. hebasto added the label Build system on Jun 9, 2025
  4. DrahtBot commented at 11:34 am on June 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/32709.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK purpleKarrot

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

  5. maflcko added the label DrahtBot Guix build requested on Jun 9, 2025
  6. in cmake/module/FindQt.cmake:44 in 2fa8e44359 outdated
    42 )
    43 
    44-foreach(component IN LISTS Qt_FIND_COMPONENTS ITEMS "")
    45-  mark_as_advanced(Qt${Qt_FIND_VERSION_MAJOR}${component}_DIR)
    46+# Mark all variables as advanced, except Qt6_DIR.
    47+# The latter can be helpful on some systems.
    


    fanquake commented at 2:17 pm on June 9, 2025:

    can be helpful on some systems.

    Can we document something more specific; I’m guessing this doesn’t close #32536?


    hebasto commented at 2:26 pm on June 9, 2025:

    can be helpful on some systems.

    Can we document something more specific;

    What do you have in mind?

    I’m guessing this doesn’t close #32536?

    Correct, it doesn’t. The Qt6_DIR cache variable can be set by the user to specify the location of a Qt 6 package that CMake cannot discover for some reason. The user should be able to see this variable in CMake’s cache.


    fanquake commented at 11:22 am on June 10, 2025:

    What do you have in mind?

    I don’t know, because it’s not clear from the commit or documentation why this is needed. I’d rather we document nothing than something vague like “can be helpful on some systems.”


    hebasto commented at 11:36 am on June 10, 2025:

    I’d rather we document nothing than something vague like “can be helpful on some systems.”

    OK. The comment has been dropped.

  7. DrahtBot commented at 9:06 pm on June 9, 2025: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit f3bbc746647d1fd23bf5cfe357e32f38c5f6319c(master) commit d04b9346b6284fc32f4d82411048e6c02fe41315(pull/32709/merge)
    *-aarch64-linux-gnu-debug.tar.gz 40197981e100908b... b3acbdc542267201...
    *-aarch64-linux-gnu.tar.gz 60ba7c50f4bd5722... 526ad3bac6eb74e6...
    *-arm-linux-gnueabihf-debug.tar.gz a8043da9d5a1633a... 09f0a6d92224eec0...
    *-arm-linux-gnueabihf.tar.gz d9b3c37efb57c91f... 4366b8a4d1230e8f...
    *-arm64-apple-darwin-codesigning.tar.gz 5f8eb68ad8238fb4... 9d129d506196743e...
    *-arm64-apple-darwin-unsigned.tar.gz 764de9c61eecfddb... 4ad964f1b3316697...
    *-arm64-apple-darwin-unsigned.zip f74980bcdeff3b06... 78033279a9305844...
    *-powerpc64-linux-gnu-debug.tar.gz 403541d3d6fbae3c... cc7b9d48e0a0b533...
    *-powerpc64-linux-gnu.tar.gz da2710959fedc2a8... 1e05894d8c1b40f3...
    *-riscv64-linux-gnu-debug.tar.gz c7aef1609b518f6c... 5b9bac9646d02df2...
    *-riscv64-linux-gnu.tar.gz 305e2a4994205ae6... 0ee2a8034395d98b...
    *-x86_64-apple-darwin-codesigning.tar.gz 3f7e82ae32d6bdcb... ede8f98d8449662c...
    *-x86_64-apple-darwin-unsigned.tar.gz 9cbe91a75b71d43f... ec7af69a94f61dc2...
    *-x86_64-apple-darwin-unsigned.zip 69a0ae70a20744a5... c24ca79651256bfb...
    *-x86_64-linux-gnu-debug.tar.gz f81f3a804acfdf9b... c8694e0c7080050e...
    *-x86_64-linux-gnu.tar.gz e709b93e3b94a118... bb154917a7310893...
    *.tar.gz a3fd8aca7a44f3e9... 88677490f1ddd0af...
    SHA256SUMS.part 593b52564f7bda5d... 215239d7b7243c53...
    guix_build.log 5653bdee5863b4be... 1b3855d3ad561808...
    guix_build.log.diff 03a02a55ef3add66...
  8. DrahtBot removed the label DrahtBot Guix build requested on Jun 9, 2025
  9. cmake: Mark more Qt package variables as advanced
    This change cleans up the user-facing part of the CMake cache following
    the migration to Qt 6.
    89d3daf823
  10. hebasto force-pushed on Jun 10, 2025
  11. in cmake/module/FindQt.cmake:52 in 89d3daf823
    50+  )
    51 endforeach()
    52+mark_as_advanced(
    53+  QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH
    54+  QT_ADDITIONAL_PACKAGES_PREFIX_PATH
    55+  XKB_INCLUDE_DIR
    


    fanquake commented at 12:50 pm on June 10, 2025:
    In 89d3daf823e4350667b42473c0924430ea7400bc: Why is XKB_* being added here?

    hebasto commented at 1:52 pm on June 16, 2025:

    They are created by Qt 6 configuration scripts internally.

    Consider the following:

     0$ rm -rf build && cmake -B build --log-level=ERROR -L | tail -n +5 > /tmp/master_no_gui
     1$ rm -rf build && cmake -B build -DBUILD_GUI=ON --log-level=ERROR -L | tail -n +5 > /tmp/master_gui
     2$ diff -u /tmp/master_no_gui /tmp/master_gui
     3--- /tmp/master_no_gui	2025-06-16 14:47:31.494243561 +0100
     4+++ /tmp/master_gui	2025-06-16 14:48:25.931426493 +0100
     5@@ -8,7 +8,8 @@
     6 BUILD_DAEMON:BOOL=ON
     7 BUILD_FOR_FUZZING:BOOL=OFF
     8 BUILD_FUZZ_BINARY:BOOL=OFF
     9-BUILD_GUI:BOOL=OFF
    10+BUILD_GUI:BOOL=ON
    11+BUILD_GUI_TESTS:BOOL=ON
    12 BUILD_KERNEL_LIB:BOOL=OFF
    13 BUILD_SHARED_LIBS:BOOL=ON
    14 BUILD_TESTS:BOOL=ON
    15@@ -22,6 +23,12 @@
    16 ENABLE_IPC:BOOL=OFF
    17 ENABLE_WALLET:BOOL=ON
    18 INSTALL_MAN:BOOL=ON
    19+QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH:STRING=
    20+QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING=
    21+Qt6CoreTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6CoreTools
    22+Qt6DBusTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6DBusTools
    23+Qt6GuiTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6GuiTools
    24+Qt6WidgetsTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6WidgetsTools
    25 REDUCE_EXPORTS:BOOL=OFF
    26 SECP256K1_APPEND_CFLAGS:STRING=
    27 SECP256K1_APPEND_LDFLAGS:STRING=
    28@@ -44,7 +51,13 @@
    29 SECP256K1_INSTALL:BOOL=OFF
    30 SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS:BOOL=OFF
    31 SECP256K1_VALGRIND:STRING=AUTO
    32+SED_EXECUTABLE:FILEPATH=/usr/bin/sed
    33 WERROR:BOOL=OFF
    34 WITH_CCACHE:BOOL=ON
    35+WITH_DBUS:BOOL=ON
    36+WITH_QRENCODE:BOOL=ON
    37 WITH_USDT:BOOL=OFF
    38 WITH_ZMQ:BOOL=OFF
    39+XGETTEXT_EXECUTABLE:FILEPATH=/usr/bin/xgettext
    40+XKB_INCLUDE_DIR:PATH=XKB_INCLUDE_DIR-NOTFOUND
    41+XKB_LIBRARY:FILEPATH=XKB_LIBRARY-NOTFOUND
    

    fanquake commented at 1:55 pm on June 16, 2025:
    If they are internal, why do we need to do anything? It seems odd that we’d need to do something specifically, for this single Qt dependency. This doesn’t really explain why this is needed.

    hebasto commented at 2:05 pm on June 16, 2025:
    CMake’s normal (non-advanced) cache variables are intended for users to override values set by the build system. I believe we should keep the list of such variables concise, including only those that may be genuinely useful to users.

    fanquake commented at 2:10 pm on June 16, 2025:
    Ok. So then this looks like a bug in Qt.

    fanquake commented at 12:22 pm on July 2, 2025:
    To be clear, I think these changes could be made, with the XKB_ change dropped. If that’s going to be kept, then there should be a link to an upstream issue.

    purpleKarrot commented at 1:03 pm on July 2, 2025:
    I don’t think upstream considers this as an issue. Whether those variables should be considered advanced or not is a matter of taste.

    fanquake commented at 1:07 pm on July 2, 2025:
    If anything, that would seem inconsistent, because they have marked every other dependency as advanced, and there’s no explanation for why XKB hasn’t been marked as such (my guess is just oversight).
  12. fanquake commented at 12:22 pm on July 2, 2025: member
  13. purpleKarrot commented at 1:01 pm on July 2, 2025: contributor
    ACK 89d3daf823e4350667b42473c0924430ea7400bc

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-07-07 18:13 UTC

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