PDA

View Full Version : Segmentation fault in Qt5.4 QGuiApplication on Ubuntu



NKumar
22nd January 2015, 16:13
I am totally new to Qt and little familiar with Ubuntu. An existing project which runs perfectly on other machines with similar configuration does not run on my machine. The project builds successfully. But while running it crashes. While debugging it says SIGSEGV segmentation fault. The project is QGuiApplication using Qt5.4.
Alternatively, I build the project from the terminal. When I run the executable, it says the same "Segmentation fault (core dumped)". But if I run with sudo, there is no error, but the application willn't launch. I wonder is there any specific problem with permissions to shared libraries it uses? or is it something related to Qt or Qt-moc.

Any hints would be useful.

anda_skoa
22nd January 2015, 16:18
You need to analyize the core dump, figure out why it is crashing.

Either run the application in the debugger or open the dumped core file with the debugger.

Cheers,
_

NKumar
22nd January 2015, 18:02
I run with valgrind with options --tool=memcheck --leak-check=full. Below is the top most content in the valgrind log file.

==8938== Process terminating with default action of signal 11 (SIGSEGV)
==8938== Bad permissions for mapped region at address 0xD6E6360
==8938== at 0x7979227: QMetaObject::className() const (in /home/nkumar/Qt/5.4/gcc_64/lib/libQt5Core.so.5.4.0)
==8938== by 0xF43DFB6: ??? (in /home/nkumar/Qt/5.4/gcc_64/lib/libQt5Widgets.so.5.4.0)
==8938== by 0x4010139: call_init.part.0 (dl-init.c:78)
==8938== by 0x4010222: _dl_init (dl-init.c:36)
==8938== by 0x4001309: ??? (in /lib/x86_64-linux-gnu/ld-2.19.so)
==8938==

It seems the segmentation fault is caused by QMetaObject::className() const (in /home/nkumar/Qt/5.4/gcc_64/lib/libQt5Core.so.5.4.0)

anda_skoa
22nd January 2015, 18:20
And what does the debugger say?
How does the backtrace look like?

Cheers,
_

thuongshoo
26th March 2015, 17:29
I guess the problem is from example code
I use directfb and I faced the same error with analogclock and rasterwindow.
I patched as the following link http://interest.qt-project.narkive.com/pjElzHIx/qt5-linuxfb-crash

--- a/examples/gui/rasterwindow/rasterwindow.cpp 2013-02-01
12:22:04.414289323 +1300
+++ b/examples/gui/rasterwindow/rasterwindow.cpp 2013-02-01
12:22:09.914337845 +1300
@@ -45,8 +45,8 @@
: QWindow(parent)
, m_update_pending(false)
{
- m_backingStore = new QBackingStore(this);
create();
+ m_backingStore = new QBackingStore(this);

setGeometry(100, 100, 300, 200);
--
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
2013-02-01 12:26:58.390337550 +1300
+++ a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
2013-02-01 12:27:10.890315043 +1300
@@ -84,6 +84,7 @@

QPlatformBackingStore
*QLinuxFbIntegration::createPlatformBackingStore(Q Window *window)
const
{
+ window->create();
return new QFbBackingStore(window);
}
--

Now I can run the examples but window posistion isnot right.