Skip to content

cmake: Fix FindQt module#32709

Closed
hebasto wants to merge 2 commits intobitcoin:masterfrom
hebasto:250609-cmake-findqt
Closed

cmake: Fix FindQt module#32709
hebasto wants to merge 2 commits intobitcoin:masterfrom
hebasto:250609-cmake-findqt

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented Jun 9, 2025

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.

The `find_package(Qt .. MODULE REQUIRED COMPONENTS ...)` call must treat
any missing component as a fatal error.
@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 9, 2025

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, BrandonOdiwuor
Approach ACK sedited

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

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 9, 2025

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

File commit f3bbc74
(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...

This change cleans up the user-facing part of the CMake cache following
the migration to Qt 6.
@hebasto hebasto force-pushed the 250609-cmake-findqt branch from 2fa8e44 to 89d3daf Compare June 10, 2025 11:35
mark_as_advanced(
QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH
QT_ADDITIONAL_PACKAGES_PREFIX_PATH
XKB_INCLUDE_DIR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 89d3daf: Why is XKB_* being added here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are created by Qt 6 configuration scripts internally.

Consider the following:

$ rm -rf build && cmake -B build --log-level=ERROR -L | tail -n +5 > /tmp/master_no_gui
$ rm -rf build && cmake -B build -DBUILD_GUI=ON --log-level=ERROR -L | tail -n +5 > /tmp/master_gui
$ diff -u /tmp/master_no_gui /tmp/master_gui
--- /tmp/master_no_gui	2025-06-16 14:47:31.494243561 +0100
+++ /tmp/master_gui	2025-06-16 14:48:25.931426493 +0100
@@ -8,7 +8,8 @@
 BUILD_DAEMON:BOOL=ON
 BUILD_FOR_FUZZING:BOOL=OFF
 BUILD_FUZZ_BINARY:BOOL=OFF
-BUILD_GUI:BOOL=OFF
+BUILD_GUI:BOOL=ON
+BUILD_GUI_TESTS:BOOL=ON
 BUILD_KERNEL_LIB:BOOL=OFF
 BUILD_SHARED_LIBS:BOOL=ON
 BUILD_TESTS:BOOL=ON
@@ -22,6 +23,12 @@
 ENABLE_IPC:BOOL=OFF
 ENABLE_WALLET:BOOL=ON
 INSTALL_MAN:BOOL=ON
+QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH:STRING=
+QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING=
+Qt6CoreTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6CoreTools
+Qt6DBusTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6DBusTools
+Qt6GuiTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6GuiTools
+Qt6WidgetsTools_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt6WidgetsTools
 REDUCE_EXPORTS:BOOL=OFF
 SECP256K1_APPEND_CFLAGS:STRING=
 SECP256K1_APPEND_LDFLAGS:STRING=
@@ -44,7 +51,13 @@
 SECP256K1_INSTALL:BOOL=OFF
 SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS:BOOL=OFF
 SECP256K1_VALGRIND:STRING=AUTO
+SED_EXECUTABLE:FILEPATH=/usr/bin/sed
 WERROR:BOOL=OFF
 WITH_CCACHE:BOOL=ON
+WITH_DBUS:BOOL=ON
+WITH_QRENCODE:BOOL=ON
 WITH_USDT:BOOL=OFF
 WITH_ZMQ:BOOL=OFF
+XGETTEXT_EXECUTABLE:FILEPATH=/usr/bin/xgettext
+XKB_INCLUDE_DIR:PATH=XKB_INCLUDE_DIR-NOTFOUND
+XKB_LIBRARY:FILEPATH=XKB_LIBRARY-NOTFOUND

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. So then this looks like a bug in Qt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think upstream considers this as an issue. Whether those variables should be considered advanced or not is a matter of taste.

Copy link
Member

@fanquake fanquake Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be addressed / reported upstream? I'd rather not undocumented work arounds, for suspected upstream issues (given that they mark all other dependencies as advanced), just to fix the output of a GUI tool.

@fanquake
Copy link
Member

fanquake commented Jul 2, 2025

cc @purpleKarrot

@purpleKarrot
Copy link
Contributor

ACK 89d3daf

Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK 89d3daf

System: macOS 15.6

Confirmed that with this change find_package(Qt .. MODULE REQUIRED COMPONENTS ...) now fails with a fatal error when components are missing (whereas master only issued a warning), and verified that the following variables are no longer exposed in the default CMake cache: QT_ADDITIONAL_HOST_PACKAGES_PR, QT_ADDITIONAL_PACKAGES_PREFIX_ , Qt6CoreTools_DIR, Qt6GuiTools_DIR, Qt6WidgetsTools_DIR

<commit: 89d3daf>
Screenshot 2025-08-17 at 21 03 31

Screenshot 2025-08-17 at 21 19 47

<branch: master>
Screenshot 2025-08-17 at 21 03 51

Screenshot 2025-08-17 at 21 21 14

@sedited
Copy link
Contributor

sedited commented Feb 2, 2026

Approach ACK

Did a guix build as an additional regression check. Agree with #32709 (comment) though that this should be reported upstream.

@fanquake
Copy link
Member

Given that half of this is now in #34578, what are we doing with the remaining commit?

@hebasto hebasto closed this Feb 13, 2026
fanquake added a commit that referenced this pull request Mar 6, 2026
0a6724a doc: Update Windows build notes (Hennadii Stepanov)
473e5f8 qt: Add patch to fix SFINAE warnings in QAnyStringView with gcc16 (Hennadii Stepanov)
3cb4d60 qt: add patches to fix SFINAE errors/warnings with gcc16 (Cory Fields)
d7e972a qt: add patch to fix build with gcc16 (Cory Fields)
19693a8 depends: Update Qt to 6.8.3 (Hennadii Stepanov)
c555845 cmake: Fix `FindQt` module (Hennadii Stepanov)

Pull request description:

  This PR updates the `qt` package in depends to the latest open-source [6.8.3](https://www.qt.io/blog/qt-6.8.3-released) LTS release.

  The update includes numerous bugfixes, which allows us to drop `qtbase_plugins_windows11style.patch`.

  Additionally, it includes [patches](#34569 (comment)) for compatibility with GCC 16 (along with one extra patch), and incorporates a [commit](8f1b55d) from #32709.

  Closes #34569.

ACKs for top commit:
  achow101:
    ACK 0a6724a
  sedited:
    ACK 0a6724a

Tree-SHA512: b66fe6f75bae00fb5c525c5fad56d39273f53f6bfd58206da8a55c6e41d14533137c72fb03e9537ba3a3d0b3463b6dcbef6a88ac2f4559fa6e9abf045fe1beaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants