[PyQt] Basic QML test seg faults in PyQT but not QT on Linux

Phil Thompson phil at riverbankcomputing.com
Thu Sep 15 15:40:31 BST 2016


On 15 Sep 2016, at 1:45 am, Louis Simons <lousimons at gmail.com> wrote:
> 
> Sorry, I screwed up and posted this last time without a subject line, which is poor etiquette and usually means nobody reads it.  I heavily apologize if everyone read this and just didn't have a response.
> 
> In trying to get a very basic PyQt5 QML example to run, I found that I get a segmentation fault.  I verified that it only seems deal with displaying QML since an example without a window runs fine.  I tried the following minimal test:
> 
>     #!/usr/bin/python3
>     import sys
>     from PyQt5.QtCore import QUrl
>     from PyQt5.QtWidgets import QApplication
>     from PyQt5.QtQml import QQmlApplicationEngine
>     
>     # Main Function
>     if __name__ == '__main__':
>         app = QApplication(sys.argv)
>         engine = QQmlApplicationEngine("simple.qml")
>         engine.quit.connect(app.quit)
>         sys.exit(app.exec_())
> 
> simple.qml:
> 
>     import QtQuick 2.5
>     import QtQuick.Controls 1.4
>     
>     ApplicationWindow {
>         width: 300
>         height: 200
>         title: "Simple"
>         visible: true
>     }
> 
> When I run this application, a window appears for a split second before closing like in the more detailed example, and I receive `Segmentation fault` in the console (and nothing more).
> 
> Running from GDB shows that the `QSGRenderThread` is receiving the SIGSEGV:
> 
>     (gdb) run snowman_qt.py 
>     Starting program: /usr/bin/python3 snowman_qt.py
>     [Thread debugging using libthread_db enabled]
>     Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>     [New Thread 0x7fffe912b700 (LWP 17200)]
>     [New Thread 0x7fffe3dbb700 (LWP 17201)]
>     [New Thread 0x7fffe1442700 (LWP 17202)]
>     [New Thread 0x7fffdbfff700 (LWP 17203)]
>     
>     Thread 5 "QSGRenderThread" received signal SIGSEGV, Segmentation fault.
>     [Switching to Thread 0x7fffdbfff700 (LWP 17203)]
>     __strstr_sse2 (haystack_start=0x0, needle_start=0x7fffe28c9dd0 "nouveau") at ../string/strstr.c:63
>     63	../string/strstr.c: No such file or directory.
> 
> If I run the QML file from a C++ application, there is no segmentation fault and the application works.  Note that I'm using PyQT without PyOtherside, but the symptoms seem similar.
> 
> Is there a way to get more information to continue debugging?
> 
> I am running Python 3.5.2 on Linux Mint 18.  My QT version is 5.7.0, my PyQt version is 5.7, and my SIP version is 4.18.1.
> 
> This is a copy of my stackoverflow question, and I apologize for spamming this issue.  I'm trying to convince a small team to look at QML over HTML5 and this is a blocker.

Works fine for me. However I would use QGuiApplication rather than QApplication.

Phil


More information about the PyQt mailing list