Bug 1847014

Summary: [FTBFS]: kwin on f33 / s390x
Product: [Fedora] Fedora Reporter: Martin Kyral <mkyral>
Component: kwinAssignee: Daniel Vrátil <me>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aoliva, dan, dmalcolm, fweimer, hannsj_uhl, jakub, jgrulich, jwakely, kde-sig, law, me, mpolacek, msebor, nickc, rdieter, than
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-23 09:52:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 467765    
Attachments:
Description Flags
preprocessed source
none
Move function template definitions to header none

Description Martin Kyral 2020-06-15 12:55:23 UTC
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:

Comment 1 Dan Horák 2020-06-15 15:58:41 UTC
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).

Comment 2 Dan Horák 2020-06-15 16:13:42 UTC
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

Comment 3 Dan Horák 2020-06-15 16:14:21 UTC
The build used gcc-10.1.1-1.fc33.s390x

Comment 4 Jonathan Wakely 2020-06-15 16:40:30 UTC
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.

Comment 5 Jeff Law 2020-06-15 16:42:48 UTC
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.

Comment 6 Dan Horák 2020-06-15 16:50:27 UTC
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
"""

Comment 7 Jonathan Wakely 2020-06-15 16:55:05 UTC
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

Comment 8 Jonathan Wakely 2020-06-15 16:57:55 UTC
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.

Comment 9 Dan Horák 2020-06-15 17:17:01 UTC
Thanks for the feedback, switching back to kwin.

Comment 10 Martin Kyral 2020-06-16 08:41:01 UTC
(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

Comment 11 Dan Horák 2020-06-16 09:03:06 UTC
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.

Comment 12 Jonathan Wakely 2020-06-16 09:09:43 UTC
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.

Comment 13 Martin Kyral 2020-06-16 12:28:47 UTC
Reported upstream:

https://bugs.kde.org/show_bug.cgi?id=423052