Description of problem: kwin 5.19 fails to build on rawhide / s390x. The reason is: /usr/bin/ld: CMakeFiles/kwin.dir/input.cpp.o: in function `KWin::TabletInputFilter::tabletToolEvent(KWin::TabletEvent*)::{lambda(KWaylandServer::TabletCursor*)#2}::operator()(KWaylandServer::TabletCursor*) const::{lambda()#1}::operator()() const': /builddir/build/BUILD/kwin-5.19.0/input.cpp:1672: undefined reference to `void KWin::WaylandCursorImage::loadThemeCursor<KWin::CursorShape>(KWin::CursorShape const&, KWin::WaylandCursorImage::Image*)' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/kwin.dir/build.make:2339: bin/libkwin.so.5.19.0] Error 1 make[2]: Leaving directory '/builddir/build/BUILD/kwin-5.19.0/s390x-redhat-linux-gnu' make[1]: *** [CMakeFiles/Makefile2:4330: CMakeFiles/kwin.dir/all] Error 2 make: *** [Makefile:164: all] Error 2 full log: https://kojipkgs.fedoraproject.org//work/tasks/7168/45747168/build.log First time I saw this issue was woth 5.18.90 (5.19 beta). Since then, it fails consistently. This problem does not happen on older kwin releases nor on other architectures. Some other important parts of plasma desktop (namely the plasma-workspace and plasma-desktop packages) depend on kwin, thus this is blocking me from building the whole stack on rawhide (even on the other architectures, where there is no problem with building). Version-Release number of selected component (if applicable): kwin-5.19.0-1.fc33 How reproducible: Always Steps to Reproduce: 1. build kwin from rawhide sources in koji 2. 3. Actual results: see description Expected results: build successfull Additional info:
So either this is a code bug (some incorrect template usage) or we have a g++ bug. I have reproduced the failure on ppc64le by adding the options s390x is using for aggressive inlining (--param=inline-min-speedup=2 --param=max-inline-insns-auto=80).
Created attachment 1697485 [details] preprocessed source command line used to compile the source file /usr/bin/c++ -DKCOREADDONS_LIB -DLIBINPUT_HAS_TOTEM -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_URL_CAST_FROM_STRING -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DQT_SCRIPT_LIB -DQT_SENSORS_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_X11EXTRAS_LIB -DQT_XML_LIB -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -Dkwin_EXPORTS -I/builddir/build/BUILD/kwin-5.19.0/s390x-redhat-linux-gnu -I/builddir/build/BUILD/kwin-5.19.0 -I/builddir/build/BUILD/kwin-5.19.0/s390x-redhat-linux-gnu/kwin_autogen/include -I/builddir/build/BUILD/kwin-5.19.0/platformsupport -I/builddir/build/BUILD/kwin-5.19.0/tabbox -I/builddir/build/BUILD/kwin-5.19.0/effects -I/builddir/build/BUILD/kwin-5.19.0/libkwineffects -I/builddir/build/BUILD/kwin-5.19.0/s390x-redhat-linux-gnu/libkwineffects -I/builddir/build/BUILD/kwin-5.19.0/s390x-redhat-linux-gnu/effects -I/usr/include/qt5/QtGui/5.14.2 -I/usr/include/qt5/QtGui/5.14.2/QtGui -I/usr/include/qt5/QtCore/5.14.2 -I/usr/include/qt5/QtCore/5.14.2/QtCore -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtDBus -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtQuick -isystem /usr/include/qt5/QtQmlModels -isystem /usr/include/qt5/QtQml -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/KF5/KConfigCore -isystem /usr/include/KF5 -isystem /usr/include/KF5/KCoreAddons -isystem /usr/include/KF5/KWindowSystem -isystem /usr/include/KF5/KDeclarative -isystem /usr/include/KF5/KPackage -isystem /usr/include/qt5/QtConcurrent -isystem /usr/include/qt5/QtScript -isystem /usr/include/qt5/QtSensors -isystem /usr/include/KF5/KConfigWidgets -isystem /usr/include/KF5/KCodecs -isystem /usr/include/KF5/KWidgetsAddons -isystem /usr/include/KF5/KConfigGui -isystem /usr/include/qt5/QtXml -isystem /usr/include/KF5/KAuth -isystem /usr/include/KF5/KGlobalAccel -isystem /usr/include/qt5/QtX11Extras -isystem /usr/include/KF5/KI18n -isystem /usr/include/KF5/KNotifications -isystem /usr/include/KF5/Plasma -isystem /usr/include/KF5/KService -isystem /usr/include/KDecoration2 -isystem /usr/include/KScreenLocker -isystem /usr/include/KF5/KActivities -isystem /usr/include/KF5/KWayland/Client -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -std=gnu++14 -o input.cpp.o -c /builddir/build/BUILD/kwin-5.19.0/input.cpp
The build used gcc-10.1.1-1.fc33.s390x
Last time we saw this it was because the function was only defined in a .cpp file not a header, and there was no explicit instantiation declaration+definition to tell the compiler it would be defined elsewhere.
I suspect something similar. Perhaps with some interaction with inlining, particularly if it's only triggering on s390. But in the end, I suspect it's an template instantiation source level issue that just happened to work in the past.
A note for reproducing - you will need a special mock config like this as the build needs deps from a side-tag repo [dan@talos kwin]$ cat /etc/mock/fedora-33-ppc64le-kde.cfg config_opts['target_arch'] = 'ppc64le' config_opts['legal_host_arches'] = ('ppc64le',) include('templates/fedora-rawhide.tpl') config_opts['dnf.conf'] += """ [local-kde] name=local-kde baseurl=https://kojipkgs.fedoraproject.org/repos/f33-kde/latest/$basearch/ cost=2000 enabled=1 skip_if_unavailable=False """
Confirmed as a kwin bug. pointer_input.h declares these function templates: class WaylandCursorImage : public QObject { Q_OBJECT public: void loadTheme(); struct Image { QImage image; QPoint hotspot; }; template <typename T> void loadThemeCursor(const T &shape, Image *image); template <typename T> void loadThemeCursor(const T &shape, QHash<T, Image> &cursors, Image *image); But they are only defined in pointer_input.cpp
Created attachment 1697489 [details] Move function template definitions to header I haven't tested this, so have no idea if the definitions actually rely on something else that is only declared in the pointer_input.cpp file.
Thanks for the feedback, switching back to kwin.
(In reply to Jonathan Wakely from comment #8) > Created attachment 1697489 [details] > Move function template definitions to header > > I haven't tested this, so have no idea if the definitions actually rely on > something else that is only declared in the pointer_input.cpp file. Thanks for the patch. Unforunatelly, it is breaking build: https://download.copr.fedorainfracloud.org/results/mkyral/plasma-unstable/fedora-32-x86_64/01466228-kwin/builder-live.log.gz
If I see right, then it needs some headers to be included in the pointer_input.h source instead of the cpp file. Please report the issue upstream, it's a real bug.
Like I said, "the definitions actually rely on something else that is only declared in the pointer_input.cpp file". If they don't want to declare KWayland in the header file then they'll need to add explicit instantiation declarations to the header for the specializations that are actually used (at least KWin::WaylandCursorImage::loadThemeCursor<KWin::CursorShape>) and then explicitly instantiate that in the .cpp file. Either way, the upstream code is not valid C++ and that's why GCC doesn't build it.
Reported upstream: https://bugs.kde.org/show_bug.cgi?id=423052
Fixed by commit: https://src.fedoraproject.org/rpms/kwin/c/851bc9bab3a1c51dd5573a229b7016a315e52f04?branch=master