Package: src:qt6-tools
Version: 6.3.1-2
Severity: normal
Tags: patch

Dear Maintainer,

This package does not currently build and link with system litehtml
as apparently desired. A build dependency on liblitehtml-dev seems
to indicate an intention for the package to use the system litehtml
for the Qt Assistant tool, though the currently packaged litehtml
(0.5-3) is not successfully found via CMake due missing the needed
litehtmlConfig.cmake file. So this bug also applies to litehtml.

Failure to build/link with the system litehtml is easily confirmed
by looking at the assistant-qt6 package [1] which shows no depends
on liblitehtml0 as would be expected if system litehtml was used.
For previous versions of qt6-tools (ie. 6.2.4) the usual CMake
status output shows the failure to find system litehtml during the
dh_auto_configure phase which includes the following output [2]:

[...]
-- The following OPTIONAL packages have not been found:

 * Qt6QmlCompilerPlus
 * litehtml
[...]

Builds of Qt 6.3.1 packages including qt6-tools have much reduced
CMake output for some reason, including on Ubuntu Launchpad (not
sure why this is so ?) and so the "not been found" message is not
shown in the build logs (ie. for latest 6.3.1-2 [3] package).

Looking into src:qt6-tools there is a 3rdparty directory [4] which
includes a full copy of litehtml source as at commit 971eadc on
2021-10-28 [5]. This is confirmed by doing a git clone of litehtml
at that exact commit, with no differences seen between that version
of litehtml source and litehtml source included in src:qt6-tools.

Builds of src:qt6-tools that successfully use and link with system
litehtml have been tested by me, through packaging the exact same
version of litehtml (0.5+git20211028) as included in src:qt6-tools.
A patch is then also required due issues with Qt CMake code (trying
to set Qt defs only applicable to source code in the Qt6 Tools
project) and a changed location of litehtml headers (after 0.5).

Builds of src:qt6-tools 6.2.4 against src:litehtml 0.5+git20211028
that demonstrate successful use and linking with the system litehtml
are now available at a recently created Launchpad PPA [6] for Ubuntu
users. So this bug does also affect qt6-tools 6.2.4-2~bpo11+1 as
found in bullseye-backports repository, confirmed by above mentioned
build logs and again by checking depends for assistant-qt6 [7].

Basic testing of the /usr/lib/qt6/bin/assistant binary (installed
via assistant-qt6 binary package) from the Launchpad PPA shows that
it appears to work as intended. Adding precompiled Qt help (.qch)
files via preferences allows browsing of the content successfully.

Attached is a proposed patch which applies cleanly to the qt6-tools
6.3.1-2 package as currently found in Sid. An adaptation of changes
made by this patch was used for 6.2.4 with the mentioned Launchpad
PPA builds, as could be done for the Bullseye qt6-tools backport.
This patch will only be useful once litehtml 0.5+git20211028 is also
packaged, due that version being required for a successful build.

A bug report will subsequently be filed for litehtml detailing the
required version and also other fixes (including updating a patch
to litehtml CMakeLists.txt) for building and linking to work with
qt6-tools successfully. Both packages will have to be updated for
that result to be achieved.

Thank you for your work maintaining the Qt6 packages.

[1] https://packages.debian.org/sid/assistant-qt6
[2]
https://buildd.debian.org/status/fetch.php?pkg=qt6-tools&arch=amd64&ver=6.2.4-3&stamp=1657216677&raw=0
[3]
https://buildd.debian.org/status/fetch.php?pkg=qt6-tools&arch=amd64&ver=6.3.1-2&stamp=1660602816&raw=0
[4] src:qt6-tools -> src/assistant/qlitehtml/src/3rdparty/litehtml
[5] https://github.com/litehtml/litehtml/commit/971eadc
[6] https://launchpad.net/~savoury1/+archive/ubuntu/qt-6-2
[7] https://packages.debian.org/bullseye-backports/assistant-qt6
 debian/changelog                                                 |  9 ++
 debian/control                                                   |  2 +-
 /dev/null => debian/patches/fix-build-with-system-litehtml.patch | 62 ++++++++
 /dev/null => debian/patches/series                               |  1 +
 4 files changed, 73 insertions(+), 1 deletion(-)

diff --git qt6-tools-6.3.1.orig/debian/changelog qt6-tools-6.3.1/debian/changelog
index eacadb8..bfb1f75 100644
--- qt6-tools-6.3.1.orig/debian/changelog
+++ qt6-tools-6.3.1/debian/changelog
@@ -1,3 +1,12 @@
+qt6-tools (6.3.1-3) UNRELEASED; urgency=medium
+
+  * Actually build with system litehtml (not previously working):
+    - debian/patches/: Add fix-build-with-system-litehtml.patch to fix FTBFS
+    - debian/control: Bump to liblitehtml-dev (>= 0.5+git20211028) BD for the
+      exact version included in src:qt6-tools, required for successful build
+
+ -- Rob Savoury <savo...@savos.tech>  Tue, 23 Aug 2022 14:06:25 -0700
+
 qt6-tools (6.3.1-2) unstable; urgency=medium
 
   [ Patrick Franz ]
diff --git qt6-tools-6.3.1.orig/debian/control qt6-tools-6.3.1/debian/control
index 66847b3..8212cb1 100644
--- qt6-tools-6.3.1.orig/debian/control
+++ qt6-tools-6.3.1/debian/control
@@ -8,7 +8,7 @@ Build-Depends: clang (>= 1:13~),
                debhelper-compat (= 13),
                libclang-dev (>= 1:13~),
                libgl-dev,
-               liblitehtml-dev,
+               liblitehtml-dev (>= 0.5+git20211028),
                libqt6opengl6-dev (>= 6.3.1+dfsg~),
                libssl-dev,
                libvulkan-dev [linux-any],
diff --git qt6-tools-6.3.1.orig/debian/patches/fix-build-with-system-litehtml.patch qt6-tools-6.3.1/debian/patches/fix-build-with-system-litehtml.patch
new file mode 100644
index 0000000..0874f65
--- /dev/null
+++ qt6-tools-6.3.1/debian/patches/fix-build-with-system-litehtml.patch
@@ -0,0 +1,62 @@
+From: Rob Savoury <savo...@savos.tech>
+Date: Tue, 23 Aug 2022 13:39:08 -0700
+Subject: Fix build with system litehtml
+
+CMake errors out when using system litehtml (which depends on gumbo) due being
+unable to set definitions for libraries not built by the Qt6 Tools project:
+
+ CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6/QtFlagHandlingHelpers.cmake:171 (target_compile_definitions):
+   Cannot specify compile definitions for target "litehtml" which is not built
+   by this project.
+ Call Stack (most recent call first):
+   src/assistant/CMakeLists.txt:34 (qt_internal_set_exceptions_flags)
+
+
+ CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6/QtFlagHandlingHelpers.cmake:190 (get_target_property):
+   get_target_property() called with non-existent target "litehtml".
+ Call Stack (most recent call first):
+   src/assistant/CMakeLists.txt:35 (qt_disable_warnings)
+
+
+ CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6/QtFlagHandlingHelpers.cmake:190 (get_target_property):
+   get_target_property() called with non-existent target "gumbo".
+ Call Stack (most recent call first):
+   src/assistant/CMakeLists.txt:37 (qt_disable_warnings)
+
+Also, litehtml > 0.5 reorganises the headers into a litehtml sub-directory
+(this build is with exactly litehtml 0.5+git20211028, the same version found
+in Qt6 Tools source code). Fix the build by removing attempts to set Qt defs
+for litehtml/gumbo and by using the new path to the primary header.
+---
+ src/assistant/CMakeLists.txt                       | 3 ---
+ src/assistant/qlitehtml/src/container_qpainter_p.h | 2 +-
+ 2 files changed, 1 insertion(+), 4 deletions(-)
+
+diff --git src/assistant/CMakeLists.txt b/src/assistant/CMakeLists.txt
+index e9b2146..3878e77 100644
+--- src/assistant/CMakeLists.txt
++++ src/assistant/CMakeLists.txt
+@@ -31,10 +31,7 @@ endif()
+ add_subdirectory(qlitehtml/src EXCLUDE_FROM_ALL)
+ if(TARGET qlitehtml)
+     qt_autogen_tools_initial_setup(qlitehtml)
+-    qt_internal_set_exceptions_flags(litehtml OFF)
+-    qt_disable_warnings(litehtml)
+     qt_disable_warnings(qlitehtml)
+-    qt_disable_warnings(gumbo)
+     qt_handle_multi_config_output_dirs(qlitehtml)
+     set_target_properties(qlitehtml PROPERTIES
+         RUNTIME_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
+diff --git src/assistant/qlitehtml/src/container_qpainter_p.h b/src/assistant/qlitehtml/src/container_qpainter_p.h
+index 074f8d7..ecfa2f3 100644
+--- src/assistant/qlitehtml/src/container_qpainter_p.h
++++ src/assistant/qlitehtml/src/container_qpainter_p.h
+@@ -30,7 +30,7 @@
+ 
+ #include "container_qpainter.h"
+ 
+-#include <litehtml.h>
++#include <litehtml/litehtml.h>
+ 
+ #include <QPaintDevice>
+ #include <QPixmap>
diff --git qt6-tools-6.3.1.orig/debian/patches/series qt6-tools-6.3.1/debian/patches/series
new file mode 100644
index 0000000..268a63c
--- /dev/null
+++ qt6-tools-6.3.1/debian/patches/series
@@ -0,0 +1 @@
+fix-build-with-system-litehtml.patch





Reply via email to