Bug 15461 - QtVirtualKeyboard segfaults
Summary: QtVirtualKeyboard segfaults
Status: RESOLVED WORKSFORME
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2023.02
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-20 02:43 UTC by info
Modified: 2023-06-21 14:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description info 2023-03-20 02:43:26 UTC
QtVirtualKeybaord program which works on 2022.02.9 segfaults on 2023.02.

My working defconfig for Pinephone (ARM) fails to run QT/QML program which incldues virtualkeyboard after upgrade to 2023.02.

Steps to reproduce: 

* Clone 2023.02 buildroot
* Arm defconfig with all standard QT packages (5.15.8)
* Setup QT Creator with toolchain and sysroot to BR produced
* Create sample QML application and include QtVirtualKeyboard
* Try to run program

Results on 2023.02:

ASSERT: "targetObjectIndex >= 0" in file ../../include/QtQml/5.15.8/QtQml/private/../../../../../src/qml/qml/qqmlpropertycachecreator_p.h, line 828

On 2022.02.9 this works without and erros.
Comment 1 Thomas Petazzoni 2023-03-21 13:23:36 UTC
Buildroot 2022.02 defaults to using GCC 10.x.
Buildroot 2023.02 defaults to using GCC 11.x, but still supports GCC 10.x.

Could you try staying with Buildroot 2023.02, but use GCC 10.x instead of GCC 11.x ?

My colleague Alexis Lothoré is also chasing down a Qt5 problem with Buildroot 2023.02 (but using the Bootlin toolchain), and reverting to an older toolchain solved the problem, which seems to point to a GCC issue.
Comment 2 Alexis Lothoré 2023-03-21 13:42:51 UTC
Hi. I indeed encounter the same kind of issue in a Qt Quick project on Armv7 target
* with Buildroot 2023.02 and Bootlin Toolchain 2022.08, Qt project crashes deep in qqmlcrashpropertycache.h (in an inlined function)
* trying to build without optimizations (to allow debugging), the application does not crash anymore
* switching back to Bootlin toolchain 2021.11, the application works, even with optimizations enabled
* I tried to switch to buildroot internal toolchain BUT with components versions (gcc, glibc, binutils, kernel headers) from bootlin toolchain 2022.08 => it still crashes, so it is probably not the Bootlin build of the toolchain which is the culprit
Comment 3 info 2023-03-22 00:53:50 UTC
Thank you for good comments. I've been trying to play with optimization level, any comments how and what you do on optimization in details would be appreciated. 

I am using buildroot internal toolchain, but will try next that compiler version change. Indeed I remember seeing some similar things years back which was triggered by GCC version. If anything, I will update results.
Comment 4 info 2023-03-22 02:08:51 UTC
I can confirm that changing GCC (buildroot toolchain) to 10.4.0 fixed my qtvirtualkeyboard error reported in this bug.
Comment 5 Alexis Lothoré 2023-03-22 13:51:09 UTC
> Thank you for good comments. I've been trying to play with optimization level, any comments how and what you do on optimization in details would be appreciated.

If you are still interested in this option, I simply added the following to package/qt5/qt5declarative/qt5declarative.mk:

QT5DECLARATIVE_CONF_OPTS += QMAKE_CXXFLAGS=-O0

I also tried with GCC12, with which the crash is still occuring, so the issue is still in GCC12. I guess next step will be to try to isolate a qt quick sample able to reproduce the issue to track the exact issue and/or share it with GNU people
Comment 6 Peter Seiderer 2023-03-22 16:36:37 UTC
With (at least) gcc-12.2.0 on RPi4 (32-bit) changing from

    BR2_OPTIMIZE_S=y

to

    BR2_OPTIMIZE_2=y

seems sufficient...

Or maybe it is worth a try to bump the versions (as the last on is from
2022-05-17, see [1])...

[1] https://git.buildroot.net/buildroot/commit/package/qt5?id=558d62490b4486f47248c63aa0eceaaa27e3069c
Comment 7 stijn.vermeir+bugzilla 2023-06-21 13:08:17 UTC
(In reply to Peter Seiderer from comment #6)
I tried a build today with Qt versions bumped like this:
qtbase            29400a683f96867133b28299c0d0bd6bcf40df35
qtdeclarative     540c4e4a5def8c350a49bb68380b787ae62490c6
qtsvg             7e6a3b38b2e898d90cef68a146cd36fda22e4363
qtvirtualkeyboard 72373522141dd3206183eb5fa56ae1c36a6d4c2b

I got these commit ids from here: https://invent.kde.org/qt/qt/qt5/-/commit/da2e0a59fa38644a95047fe389d955dc71b31fc8

I was using buildroot 2023.02.2 internal toolchain for this with gcc-12.3.0.

The virtual keyboard still segfaults.

I am also trying with gcc-10 now to see if this fixes the segfault here.
Comment 8 stijn.vermeir+bugzilla 2023-06-21 14:46:56 UTC
Indeed here also no segfault anymore after switching to gcc 10!