From 2db624347f532abeb0e19bc9c5c4d7281f8ea233 Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Sun, 5 Jul 2026 18:36:43 +0800 Subject: [PATCH] [qtbase] fix windeployqt webengine deployment for debug builds (#52702) Co-authored-by: Billy O'Neal --- ports/qtbase/portfile.cmake | 5 +++ ports/qtbase/qt.conf.in | 4 +-- ports/qtbase/vcpkg.json | 1 + ...indeployqt-webengine-debug-resources.patch | 35 +++++++++++++++++++ versions/baseline.json | 2 +- versions/q-/qtbase.json | 5 +++ 6 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 ports/qtbase/windeployqt-webengine-debug-resources.patch diff --git a/ports/qtbase/portfile.cmake b/ports/qtbase/portfile.cmake index 626e5c9c7e..b478e592e1 100644 --- a/ports/qtbase/portfile.cmake +++ b/ports/qtbase/portfile.cmake @@ -21,6 +21,7 @@ set(${PORT}_PATCHES clang-cl_QGADGET_fix.diff fix-host-aliasing.patch fix_deploy_windows.patch + windeployqt-webengine-debug-resources.patch fix-link-lib-discovery.patch macdeployqt-symlinks.patch moltenvk.patch @@ -497,6 +498,7 @@ endif() set(_file "${CMAKE_CURRENT_LIST_DIR}/qt.conf.in") set(REL_PATH "") set(REL_HOST_TO_DATA "\${CURRENT_INSTALLED_DIR}/") +set(LIBEXEC_DEBUG_SUFFIX "") configure_file("${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/qt_release.conf" @ONLY) # For vcpkg-qmake set(BACKUP_CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}") set(BACKUP_CURRENT_HOST_INSTALLED_DIR "${CURRENT_HOST_INSTALLED_DIR}") @@ -507,6 +509,9 @@ set(CURRENT_HOST_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}${installed_to_host}") set(REL_HOST_TO_DATA "${host_to_installed}") configure_file("${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/qt.conf") set(REL_PATH debug/) +if(VCPKG_TARGET_IS_WINDOWS) + set(LIBEXEC_DEBUG_SUFFIX "/debug") +endif() configure_file("${_file}" "${CURRENT_PACKAGES_DIR}/tools/Qt6/bin/qt.debug.conf") set(CURRENT_INSTALLED_DIR "${BACKUP_CURRENT_INSTALLED_DIR}") diff --git a/ports/qtbase/qt.conf.in b/ports/qtbase/qt.conf.in index 8e76b8f6d3..b9fdf19153 100644 --- a/ports/qtbase/qt.conf.in +++ b/ports/qtbase/qt.conf.in @@ -6,7 +6,7 @@ Plugins=@REL_PATH@@QT6_DIRECTORY_PREFIX@plugins Qml2Imports=@REL_PATH@@QT6_DIRECTORY_PREFIX@qml Documentation=doc/@QT6_DIRECTORY_PREFIX@ Binaries=@REL_PATH@bin -LibraryExecutables=tools/Qt6/bin +LibraryExecutables=tools/Qt6/bin@LIBEXEC_DEBUG_SUFFIX@ ArchData=share/Qt6 Data=share/Qt6 Translations=translations/@QT6_DIRECTORY_PREFIX@ @@ -19,7 +19,7 @@ Plugins=@REL_PATH@@QT6_DIRECTORY_PREFIX@plugins Qml2Imports=@REL_PATH@@QT6_DIRECTORY_PREFIX@qml Documentation=doc/@QT6_DIRECTORY_PREFIX@ Binaries=@REL_PATH@bin -LibraryExecutables=tools/Qt6/bin +LibraryExecutables=tools/Qt6/bin@LIBEXEC_DEBUG_SUFFIX@ ArchData=share/Qt6 Data=share/Qt6 Translations=translations/@QT6_DIRECTORY_PREFIX@ diff --git a/ports/qtbase/vcpkg.json b/ports/qtbase/vcpkg.json index 8c3a10aff8..7042d8d14e 100644 --- a/ports/qtbase/vcpkg.json +++ b/ports/qtbase/vcpkg.json @@ -1,6 +1,7 @@ { "name": "qtbase", "version": "6.11.1", + "port-version": 1, "description": "Qt Base (Core, Gui, Widgets, Network, ...)", "homepage": "https://www.qt.io/", "license": null, diff --git a/ports/qtbase/windeployqt-webengine-debug-resources.patch b/ports/qtbase/windeployqt-webengine-debug-resources.patch new file mode 100644 index 0000000000..c9c6068533 --- /dev/null +++ b/ports/qtbase/windeployqt-webengine-debug-resources.patch @@ -0,0 +1,35 @@ +Locate the debug Qt WebEngine resources under the vcpkg debug tree. + +In the vcpkg layout the qtwebengine port moves the release WebEngine resources +into share/Qt6/resources (== QT_INSTALL_DATA/resources), but keeps the debug +".debug.pak" resources under /debug/resources. QT_INSTALL_DATA is shared +between the debug and release configurations, so windeployqt looked for the debug +resources in share/Qt6/resources and failed with e.g. + "...\share\Qt6\resources\qtwebengine_resources.debug.pak does not exist." + +Resolve the resources from QT_INSTALL_PREFIX/debug for a debug deployment; the +release path is unchanged. Paired with the LibraryExecutables fix in qt.conf.in +(which points QT_INSTALL_LIBEXECS at tools/Qt6/bin/debug for the debug config), +this lets windeployqt deploy Qt WebEngine for debug builds without relocating any +debug binaries into the non-debug tree. + +diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp +index 839a0b4..bd0590e 100644 +--- a/src/tools/windeployqt/main.cpp ++++ b/src/tools/windeployqt/main.cpp +@@ -1955,8 +1955,13 @@ static bool deployWebEngineCore(const QMap &qtpathsVariables, + if (!deployWebProcess(qtpathsVariables, webEngineProcessName, pluginInfo, options, errorMessage)) + return false; + const QString resourcesSubDir = QStringLiteral("/resources"); +- const QString resourcesSourceDir = qtpathsVariables.value(QStringLiteral("QT_INSTALL_DATA")) +- + resourcesSubDir + u'/'; ++ // vcpkg keeps the debug Qt WebEngine resources (.debug.pak) under /debug/resources, ++ // separate from the release resources in QT_INSTALL_DATA/resources. QT_INSTALL_DATA is shared ++ // between debug and release, so resolve the debug resources from the prefix instead. ++ const QString resourcesBaseDir = isDebug ++ ? qtpathsVariables.value(QStringLiteral("QT_INSTALL_PREFIX")) + QStringLiteral("/debug") ++ : qtpathsVariables.value(QStringLiteral("QT_INSTALL_DATA")); ++ const QString resourcesSourceDir = resourcesBaseDir + resourcesSubDir + u'/'; + const QString resourcesTargetDir(options.directory + resourcesSubDir); + if (!createDirectory(resourcesTargetDir, errorMessage, options.dryRun)) + return false; diff --git a/versions/baseline.json b/versions/baseline.json index bd18aae8b8..4d14e8d0f4 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8410,7 +8410,7 @@ }, "qtbase": { "baseline": "6.11.1", - "port-version": 0 + "port-version": 1 }, "qtcharts": { "baseline": "6.11.1", diff --git a/versions/q-/qtbase.json b/versions/q-/qtbase.json index bb4004c9db..be7e0af7ef 100644 --- a/versions/q-/qtbase.json +++ b/versions/q-/qtbase.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d5dcf61ca1fc4fb94a69b3b7fadff76587ecd0d5", + "version": "6.11.1", + "port-version": 1 + }, { "git-tree": "29a7f9f115d568b271a3b99fabeac886ec248f9f", "version": "6.11.1",