Skip to content

fix: find Qt6 private packages explicitly on Qt >= 6.10 - #226

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix/qt6.12-build
Nov 19, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix/qt6.12-build

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the Qt 6.12 toolchain the packaging of dde-services fails at cmake configure time (same root cause as deepin-screensaver#139 / fcitx5-qt#13 / kf6-kconfigwidgets#2 / kf6-kdbusaddons#7 / kf6-kirigami#6, and the uos-ai fix of the same family):

CMake Error at src/plugin-qt/shortcut/CMakeLists.txt:237 (target_link_libraries):
  Target "dde-global-shortcuts-provider" links to:
    Qt6::WaylandClientPrivate
  but the target was not found.
CMake Error at src/plugin-qt/shortcut/tests/CMakeLists.txt:403 (target_link_libraries):
  Target "tst-globalshortcutsprovider" links to:
    Qt6::WaylandClientPrivate
  but the target was not found.

Two upstream changes stack up:

  1. Qt >= 6.10 no longer implicitly loads <Module>Private CMake configs. This project only does find_package(Qt6 COMPONENTS ... Gui WaylandClient ...), then uses ${Qt6Gui_PRIVATE_INCLUDE_DIRS}, ${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS} and links Qt6::WaylandClientPrivate.
  2. In Qt 6.12 the WaylandClient module moved from qtwayland into qtbase, so the Qt6WaylandClientPrivate config is now shipped by qt6-base-dev (files exist, just never loaded).

Change

src/plugin-qt/shortcut/CMakeLists.txt: version-gated explicit lookup right after the public component find:

if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0")
    find_package(Qt6GuiPrivate REQUIRED NO_MODULE)
endif()
if (Qt6WaylandClient_VERSION VERSION_GREATER_EQUAL "6.10.0")
    find_package(Qt6WaylandClientPrivate REQUIRED NO_MODULE)
endif()

The tests target (tst-globalshortcutsprovider) needs no own lookup: the imported target is GLOBAL once the parent directory found it (same mechanism that made it work on Qt <= 6.9). On Qt <= 6.9 (incl. the 6.8 baseline) the gates are not taken and behavior is unchanged.

Test

Full binary build of master + this patch in a UOS 25 cleanroom with qt6-base 6.12.0.5: LC_ALL=C.UTF-8 dpkg-buildpackage -b -us -uc succeeds, dde-services_1.0.50_amd64.deb (+ dbgsym/buildinfo) produced, previously-failing configure passes (Configuring done (7.7s)).

PMS: TASK-396869

Summary by Sourcery

Bug Fixes:

  • Fix Qt 6.10 and newer builds by explicitly locating the required Qt private package configurations.

1. Qt 6.10+ no longer implicitly loads Private CMake configs; add
   version-gated find_package for Qt6GuiPrivate and
   Qt6WaylandClientPrivate in shortcut plugin
2. Required by ${Qt6Gui_PRIVATE_INCLUDE_DIRS},
   ${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS} and the
   Qt6::WaylandClientPrivate link target (tests target inherits
   the global imported target)
3. WaylandClient moved into qtbase in Qt 6.12, its Private config
   is shipped by qt6-base-dev

Log: fix CMake configure failure on Qt 6.12 ("Target
dde-global-shortcuts-provider links to Qt6::WaylandClientPrivate
but the target was not found"); no runtime behavior change

Influence:
1. Rebuild dde-services against qt6-base 6.12.0.5 in UOS 25
   cleanroom, confirm all binary packages are produced
2. Verify global shortcuts provider works (shortcut registration
   and triggering) on the Qt 6.12 desktop
3. Run tst-globalshortcutsprovider unit tests

fix: Qt >= 6.10 需显式查找 Qt6 Private 包

1. Qt 6.10 起不再隐式加载 Private CMake 配置,shortcut 插件
   增加版本门槛的 Qt6GuiPrivate / Qt6WaylandClientPrivate 查找
2. 覆盖 ${Qt6Gui_PRIVATE_INCLUDE_DIRS}、
   ${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS} 变量与
   Qt6::WaylandClientPrivate 链接目标(tests 目标经全局
   imported target 自动可见)
3. Qt 6.12 起 WaylandClient 并入 qtbase,Private 配置由
   qt6-base-dev 提供

Log: 修复 Qt 6.12 下 CMake configure 失败("Target
dde-global-shortcuts-provider links to Qt6::WaylandClientPrivate
but the target was not found"),不改变运行时行为

Influence:
1. 在 UOS 25 净室用 qt6-base 6.12.0.5 重新构建 dde-services,
   确认全部二进制包产出
2. 在 Qt 6.12 桌面验证全局快捷键注册与触发功能正常
3. 跑 tst-globalshortcutsprovider 单元测试

PMS: TASK-396869
@sourcery-ai

sourcery-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Explicitly find Qt private CMake packages on Qt 6.10 and later so their include directories and imported targets are available.

  • src/plugin-qt/shortcut/CMakeLists.txt L13-20

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/plugin-qt/shortcut/CMakeLists.txt" line_range="16" />
<code_context>
+# Qt >= 6.10 不再隐式加载 Private 配置, 使用 <Module>_PRIVATE_INCLUDE_DIRS 变量或链接
+# Qt6::<Module>Private target 前需显式查找 (Qt 6.12 起 WaylandClient 并入 qtbase)
+if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0")
+    find_package(Qt6GuiPrivate REQUIRED NO_MODULE)
+endif()
+if (Qt6WaylandClient_VERSION VERSION_GREATER_EQUAL "6.10.0")
</code_context>
<issue_to_address>
**Provider tests miss GUI private headers**

When qt is 6.10 or newer and `BUILD_TESTING` is enabled, unless `Qt6::WaylandClientPrivate` happens to propagate the GUI private include directory transitively, `tst-globalshortcutsprovider` compiles `waylandforeignparent.cpp`, which includes `<qpa/qplatformnativeinterface.h>`, but its include directories do not add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}`. Unlike the provider target, the test target therefore cannot find that private header when tests are built, so the test build fails.

Add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}` to the test target’s include directories or link it to `Qt6::GuiPrivate`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

# Qt >= 6.10 不再隐式加载 Private 配置, 使用 <Module>_PRIVATE_INCLUDE_DIRS 变量或链接
# Qt6::<Module>Private target 前需显式查找 (Qt 6.12 起 WaylandClient 并入 qtbase)
if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0")
find_package(Qt6GuiPrivate REQUIRED NO_MODULE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Provider tests miss GUI private headers

When qt is 6.10 or newer and BUILD_TESTING is enabled, unless Qt6::WaylandClientPrivate happens to propagate the GUI private include directory transitively, tst-globalshortcutsprovider compiles waylandforeignparent.cpp, which includes <qpa/qplatformnativeinterface.h>, but its include directories do not add ${Qt6Gui_PRIVATE_INCLUDE_DIRS}. Unlike the provider target, the test target therefore cannot find that private header when tests are built, so the test build fails.

Add ${Qt6Gui_PRIVATE_INCLUDE_DIRS} to the test target’s include directories or link it to Qt6::GuiPrivate.

Prompt for AI agents
In `src/plugin-qt/shortcut/CMakeLists.txt` at line 16:

**Provider tests miss GUI private headers**

When qt is 6.10 or newer and `BUILD_TESTING` is enabled, unless `Qt6::WaylandClientPrivate` happens to propagate the GUI private include directory transitively, `tst-globalshortcutsprovider` compiles `waylandforeignparent.cpp`, which includes `<qpa/qplatformnativeinterface.h>`, but its include directories do not add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}`. Unlike the provider target, the test target therefore cannot find that private header when tests are built, so the test build fails.

Add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}` to the test target’s include directories or link it to `Qt6::GuiPrivate`.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit e9011b2 into linuxdeepin:master Nov 19, 2026
9 of 10 checks passed
@pengfeixx
pengfeixx deleted the fix/qt6.12-build branch November 19, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants