#1032307 kwin FTCBFS: the devil is in the detail

Package:
src:kwin
Source:
src:kwin
Submitter:
Helmut Grohne
Date:
2023-03-03 11:57:04 UTC
Severity:
normal
Tags:
#1032307#5
Date:
2023-03-03 06:52:04 UTC
From:
To:
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