Bug#1032307: kwin FTCBFS: the devil is in the detail
Source: kwin
Version: 4:5.27.0-1
Tags: patch
User: debian-cross@lists.debian.org
Usertags: ftcbfs
X-Debbugs-Cc: debian-cross@lists.debian.org
Hi,
I noticed that kwin fails to cross build from source and while looking
into it, it turned ever more complex. I'll copy it to d-cross@l.d.o for
instruction purposes.
The immediate failure looked fairly simple to me:
| In file included from /<<PKGBUILDDIR>>/obj-mipsel-linux-gnu/src/kwin_autogen/IEXH3JLKNG/moc_drmlease_v1_interface_p.cpp:10,
| from /<<PKGBUILDDIR>>/obj-mipsel-linux-gnu/src/kwin_autogen/mocs_compilation.cpp:159:
| /<<PKGBUILDDIR>>/obj-mipsel-linux-gnu/src/kwin_autogen/IEXH3JLKNG/../../../../src/wayland/drmlease_v1_interface_p.h:52:10: error: ‘void KWaylandServer::DrmLeaseDeviceV1Interface::wp_drm_lease_device_v1_destroy_global()’ marked ‘override’, but does not override
| 52 | void wp_drm_lease_device_v1_destroy_global() override;
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| make[3]: *** [src/CMakeFiles/kwin.dir/build.make:235: src/CMakeFiles/kwin.dir/kwin_autogen/mocs_compilation.cpp.o] Error 1
I thought, this probably also fails natively and I can file a FTBFS.
Nope, it builds natively. Then I actually looked into the source and
found that wp_drm_lease_device_v1_destroy_global is a method in a class
DrmLeaseDeviceV1Interface supposedly inherited from
QtWaylandServer::wp_drm_lease_device_v1, for which I couldn't locate any
source with codesearch. That's when Sune Vuorela reminded me of
qtwaylandscanner. I thought that since we're using the same
qtwaylandscanner binary for both the native amd64 build and the amd64 ->
mipsel cross build, the difference must be the compiler invocation, so I
compared it and found that really the only difference was the compiler
binary name. Bummer. After a little more time, I actually went down and
compared the qtwaylandscanner invocation lines and observed that
qtwaylandscanner (cross build) != qtwaylandscanner_kde (native build)
and that their outputs would differ in precisely the method that is
missing here. So then I looked for where qtwaylandscanner_kde would come
from and learned that we aren't supposed to pass it but rather
src/wayland/tools/CMakeLists.txt wants to build it itself and you should
be passing a KF5_HOST_TOOLING path. Note that when kde says "host", GNU
people need to read "build". So I tried setting that, but it influences
a ton of other packages and would require me to install the entire KF5
stack natively. I then noticed that it only really is being used to
derive a NATIVE_PREFIX, which only actually needs to contain a native
qt5 base. So I tried patching out the requirement for passing
KF5_HOST_TOOLING and that actually happened to work.
I hope that this was educational or entertaining to read. If not, you
can just apply the attached patch and have kwin cross build again.
Helmut
diff --minimal -Nru kwin-5.27.0/debian/changelog kwin-5.27.0/debian/changelog
--- kwin-5.27.0/debian/changelog 2023-02-18 17:08:46.000000000 +0100
+++ kwin-5.27.0/debian/changelog 2023-03-02 08:43:06.000000000 +0100
@@ -1,3 +1,15 @@
+kwin (4:5.27.0-1.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix FTCBFS: (Closes: #-1)
+ + qtwaylandscanner != qtwaylandscanner_kde. Don't pass it.
+ + Instead pass NATIVE_PREFIX of a qt5 base installation to build
+ a native qtwaylandscanner_kde as ExternalProject.
+ + Do not require a full native KF5 toolchain.
+ + Require a native qt5 base.
+
+ -- Helmut Grohne <helmut@subdivi.de> Thu, 02 Mar 2023 08:43:06 +0100
+
kwin (4:5.27.0-1) unstable; urgency=medium
[ Pino Toscano ]
diff --minimal -Nru kwin-5.27.0/debian/control kwin-5.27.0/debian/control
--- kwin-5.27.0/debian/control 2023-02-17 22:43:47.000000000 +0100
+++ kwin-5.27.0/debian/control 2023-03-02 08:43:06.000000000 +0100
@@ -85,6 +85,7 @@
plasma-wayland-protocols (>= 1.9.0~),
python3:any,
qtbase5-dev (>= 5.15.2~),
+ qtbase5-dev:native (>= 5.15.2~),
qtbase5-private-dev,
qtdeclarative5-dev (>= 5.15.2~),
qttools5-dev (>= 5.15.2~),
diff --minimal -Nru kwin-5.27.0/debian/patches/cross.patch kwin-5.27.0/debian/patches/cross.patch
--- kwin-5.27.0/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100
+++ kwin-5.27.0/debian/patches/cross.patch 2023-03-02 08:43:06.000000000 +0100
@@ -0,0 +1,19 @@
+--- kwin-5.27.0.orig/src/wayland/tools/CMakeLists.txt
++++ kwin-5.27.0/src/wayland/tools/CMakeLists.txt
+@@ -13,13 +13,12 @@
+ add_executable(qtwaylandscanner_kde IMPORTED GLOBAL)
+ set_target_properties(qtwaylandscanner_kde PROPERTIES IMPORTED_LOCATION ${QTWAYLANDSCANNER_KDE_EXECUTABLE})
+ elseif(CMAKE_CROSSCOMPILING)
+- if (NOT KF5_HOST_TOOLING)
+- message(FATAL_ERROR "Please provide a prefix with a native Qt build and pass -DKF5_HOST_TOOLING=path")
+- endif()
+-
+ # search native tooling prefix
+ set(NATIVE_PREFIX "" CACHE STRING "CMAKE_PREFIX_PATH for native Qt libraries")
+ if (NOT NATIVE_PREFIX)
++ if (NOT KF5_HOST_TOOLING)
++ message(FATAL_ERROR "Please provide a prefix with a native Qt build and pass -DKF5_HOST_TOOLING=path")
++ endif()
+ string(FIND ${KF5_HOST_TOOLING} /lib idx)
+ string(SUBSTRING ${KF5_HOST_TOOLING} 0 ${idx} NATIVE_PREFIX)
+ endif()
diff --minimal -Nru kwin-5.27.0/debian/patches/series kwin-5.27.0/debian/patches/series
--- kwin-5.27.0/debian/patches/series 2022-10-02 18:15:15.000000000 +0200
+++ kwin-5.27.0/debian/patches/series 2023-03-02 08:43:06.000000000 +0100
@@ -1 +1,2 @@
uninitialized-yuvformat.patch
+cross.patch
diff --minimal -Nru kwin-5.27.0/debian/rules kwin-5.27.0/debian/rules
--- kwin-5.27.0/debian/rules 2023-02-16 22:18:01.000000000 +0100
+++ kwin-5.27.0/debian/rules 2023-03-02 08:43:06.000000000 +0100
@@ -3,6 +3,8 @@
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+include /usr/share/dpkg/architecture.mk
+
libpkgs_gen_strict_local_shlibs = $(libpkgs_all_packages) kwin-common
include /usr/share/pkg-kde-tools/qt-kde-team/2/library-packages.mk
@@ -15,7 +17,7 @@
override_dh_auto_configure:
dh_auto_configure -Skf5 -- -DBUILD_TESTING=OFF \
- -DQTWAYLANDSCANNER_KDE_EXECUTABLE=/usr/lib/qt5/bin/qtwaylandscanner
+ -DNATIVE_PREFIX=/usr/lib/$(DEB_BUILD_MULTIARCH)/cmake
override_dh_auto_test:
# Disable auto tests at build time
Reply to: