Bug 422886

Summary: Kexi fails to build with GCC 10
Product: [Applications] KReport Reporter: Wolfgang Bauer <wbauer1>
Component: generalAssignee: Jarosław Staniek <staniek>
Status: CLOSED FIXED    
Severity: normal CC: adam, inksi, rdieter, staniek
Priority: HI    
Version: 3.2.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 3.2.1
Sentry Crash Report:
Attachments: Move the methods to cpp
V2 patch

Description Wolfgang Bauer 2020-06-12 17:18:19 UTC
The build fails with the following linker errors since updating to Qt 5.15.0:
[  300s] /usr/lib/gcc/i586-suse-linux/10/../../../../i586-suse-linux/bin/ld: /tmp/kexi_reportplugin.so.SHZfI0.ltrans0.ltrans.o: in function `KRScriptFunctions::qt_metacast(char const*)':
[  300s] <artificial>:(.text+0x87f6): undefined reference to `KReportGroupTracker::qt_metacast(char const*)'
[  300s] /usr/lib/gcc/i586-suse-linux/10/../../../../i586-suse-linux/bin/ld: /tmp/kexi_reportplugin.so.SHZfI0.ltrans0.ltrans.o: in function `KRScriptFunctions::qt_metacall(QMetaObject::Call, int, void**)':
[  300s] <artificial>:(.text+0x8836): undefined reference to `KReportGroupTracker::qt_metacall(QMetaObject::Call, int, void**)'
[  300s] /usr/lib/gcc/i586-suse-linux/10/../../../../i586-suse-linux/bin/ld: /tmp/kexi_reportplugin.so.SHZfI0.ltrans0.ltrans.o:(.data.rel.ro+0x14): undefined reference to `typeinfo for KReportGroupTracker'
[  300s] /usr/lib/gcc/i586-suse-linux/10/../../../../i586-suse-linux/bin/ld: /tmp/kexi_reportplugin.so.SHZfI0.ltrans0.ltrans.o:(.data.rel.ro+0x684): undefined reference to `KReportGroupTracker::staticMetaObject'
[  300s] /usr/lib/gcc/i586-suse-linux/10/../../../../i586-suse-linux/bin/ld: /tmp/kexi_reportplugin.so.SHZfI0.ltrans1.ltrans.o: in function `KRScriptFunctions::~KRScriptFunctions()':
[  300s] <artificial>:(.text+0x1cd8): undefined reference to `vtable for KReportGroupTracker'
Comment 1 Wolfgang Bauer 2020-06-12 20:25:31 UTC
Hm, I'm not sure that GCC 10 is really the problem here, as I tried to build it with GCC 7 on Tumbleweed as well, and it still failed...

Although, it does indeed still build fine on Leap 15.1 with the latest KF5 and Qt5...
Comment 2 Wolfgang Bauer 2020-06-12 20:43:35 UTC
(In reply to Wolfgang Bauer from comment #1)
> Hm, I'm not sure that GCC 10 is really the problem here, as I tried to build
> it with GCC 7 on Tumbleweed as well, and it still failed...
Might have been a different problem though, so it's likely indeed related to gcc 10.
Comment 3 Jarosław Staniek 2020-06-13 20:55:03 UTC
Hi, thanks for reporting. 
One possible issue is KEXI linking to a KReport library that is built without scripting.
Comment 4 Jarosław Staniek 2020-06-13 21:00:01 UTC
I meant the header config-kreport.h may have KREPORT_SCRIPTING defined but the actual abstract KReportGroupTracker object is not exported. 

Similar effect can be observed if the compiler does not allow inline constructors anymore for such linkage. I am attaching a test patch for KReport 3.2 for you to try it - KReportGroupTracker is defined non-inline this time.
Could you please try to build KReport with it?
Comment 5 Jarosław Staniek 2020-06-13 21:00:56 UTC
Created attachment 129330 [details]
Move the methods to cpp
Comment 6 Wolfgang Bauer 2020-06-16 14:28:28 UTC
(In reply to Jarosław Staniek from comment #5)
> Created attachment 129330 [details]
> Move the methods to cpp
Unfortunately, building kreport fails already now:
[  132s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libKReport3.so.4.2.0.RUCrZz.ltrans4.ltrans.o: in function `KReportGroupTracker::KReportGroupTracker()':
[  132s] <artificial>:(.text+0x58e): undefined reference to `vtable for KReportGroupTracker'
[  132s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libKReport3.so.4.2.0.RUCrZz.ltrans4.ltrans.o: in function `KReportGroupTracker::~KReportGroupTracker()':
[  132s] <artificial>:(.text+0x5a3): undefined reference to `vtable for KReportGroupTracker'
[  132s] collect2: error: ld returned 1 exit status
Comment 7 Jarosław Staniek 2020-06-16 15:14:51 UTC
Created attachment 129419 [details]
V2 patch

Please try to build KReport with V2 patch, thanks.
Comment 8 Wolfgang Bauer 2020-06-16 17:10:18 UTC
(In reply to Jarosław Staniek from comment #7)
> Created attachment 129419 [details]
> V2 patch
> 
> Please try to build KReport with V2 patch, thanks.
Yes, with the 2nd patch, kreport builds fine.
And kexi's build succeeded as well afterwards.
Comment 9 Jarosław Staniek 2020-06-16 19:52:14 UTC
Great, so I am changing the product to KReport and applying the fix. Thanks!
Comment 10 Jarosław Staniek 2020-06-16 20:01:47 UTC
Git commit 5d3053ea78b349b81b7a562974ad78f93d169791 by Jaroslaw Staniek.
Committed on 16/06/2020 at 20:00.
Pushed by staniek into branch '3.2'.

Fix build with GCC 10 (make KReportGroupTracker use C++ file)
CCMAIL:adam@piggz.co.uk

FIXED-IN:3.2.1

M  +1    -4    src/CMakeLists.txt
A  +26   -0    src/renderer/scripting/KReportGroupTracker.cpp     [License: LGPL (v2.1+)]
M  +21   -4    src/renderer/scripting/KReportGroupTracker.h

https://invent.kde.org/libraries/kreport/commit/5d3053ea78b349b81b7a562974ad78f93d169791