Segfault using PyQt5 with Raspbian

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Segfault using PyQt5 with Raspbian

Xenoshell
Hello,
i want to use my Raspberry Pi with a USB Camera in a GUI. I am working with
Qt5 and python3.5. The problem is when the code is at /self.camvfind.show()
/ or /self.cam.setViewfinder(self.camvfind)/ it sometimes results in a
segmentation fault or it actually shows the camera feed. So it can work but
not always. I am really confused by this. Here is  my complete code
<https://github.com/Xenoshell/raspberry/blob/master/qt.py>  . Its just a
little bit too long to show everything here but the most interesting
function is this:
    def startVid(self):
        self.camvfind.show()
       
        self.cam.setViewfinder(self.camvfind)

        self.cam.setCaptureMode(self.cammode)
        self.cam.start()

I already tried to debug with gdb and the outout was:
(gdb) bt
#0  0x733d4620 in platform_get_handle () from /opt/vc/lib/libEGL.so
#1  0x733c9f2c in eglCreateWindowSurface () from /opt/vc/lib/libEGL.so
#2  0x722e7004 in ?? ()
  from
/usr/lib/arm-linux-gnueabihf/qt5/plugins/xcbglintegrations/libqxcb-egl-integration.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


Feel free to ask me questions.
Greets,
Xenoshell



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Segfault using PyQt5 with Raspbian

David Boddie
On Thu Nov 30 12:01:22 GMT 2017, Xenoshell wrote:

> i want to use my Raspberry Pi with a USB Camera in a GUI. I am working with
> Qt5 and python3.5.

Which version of Raspbian?

> The problem is when the code is at /self.camvfind.show()
> / or /self.cam.setViewfinder(self.camvfind)/ it sometimes results in a
> segmentation fault or it actually shows the camera feed. So it can work but
> not always. I am really confused by this. Here is  my complete code
> <https://github.com/Xenoshell/raspberry/blob/master/qt.py>  . Its just a
> little bit too long to show everything here but the most interesting
>
> function is this:
>     def startVid(self):
>         self.camvfind.show()
>        
>         self.cam.setViewfinder(self.camvfind)
>        
>         self.cam.setCaptureMode(self.cammode)
>         self.cam.start()

Is the order of these calls important? What happens if you show the camvfind
widget last?

> I already tried to debug with gdb and the outout was:
> (gdb) bt
> #0  0x733d4620 in platform_get_handle () from /opt/vc/lib/libEGL.so
> #1  0x733c9f2c in eglCreateWindowSurface () from /opt/vc/lib/libEGL.so
> #2  0x722e7004 in ?? ()
>
>   from
>
> /usr/lib/arm-linux-gnueabihf/qt5/plugins/xcbglintegrations/libqxcb-egl-integ
> ration.so Backtrace stopped: previous frame identical to this frame (corrupt
> stack?)

I did what I tend to do in these situations and searched for part of the
backtrace. In this case I searched for

  platform_get_handle () from /opt/vc/lib/libEGL.so

I haven't thoroughly read through the advice you got in other forums, so I
can't be sure if I'm repeating someone else:

https://raspberrypi.stackexchange.com/questions/75597/segmentation-fault-running-out-of-memory-pyqt5

https://forum.qt.io/topic/84893/resizing-a-constant-video-stream-from-opencv-to-pyqt5-with-qpainter-in-a-qwidget-using-a-raspberry-pi/24

https://forum.qt.io/topic/85511/segmentation-fault-trying-to-display-camera-feed

Anyway, I found a couple of responses to similar questions that might be
useful, even if one of them is for Ubuntu and not Raspbian:

https://raspberrypi.stackexchange.com/questions/61078/qt-applications-dont-work-due-to-libegl

https://code.mythtv.org/trac/ticket/12757

My advice is to check whether there is more than one copy of libEGL installed
and to use LD_LIBRARY_PATH to select each one to see if it makes a
difference.

David
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Segfault using PyQt5 with Raspbian

Xenoshell
My Raspbian Version is Stretch 9
I got the order of the code from the official qt website, which i translated
from c++ to python.
I tried switching around the camvfind.show but it resulted in segfault
These are all the libEGL i found:
/opt/vc/lib/libEGL.so
/home/pi/.local/share/Trash/files/libEGL.so
/usr/lib/chromium-browser/libEGL.so
/usr/lib/arm-linux-gnueabihf/libEGL.so

I will definitely try what the guy on raspberrypi.stackexchange suggested
and if that also fails
i will just setup a new raspbian, because i have installed/removed so much
on this setup.
It could actually be that something that i dont even think about right now
could cause a problem
Thanks for the help, i will report back

Xenoshell



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Segfault using PyQt5 with Raspbian

Xenoshell
I tried the first commands in the raspberrypi.stackexchange site and i
already run into errors. Tbh i have enough of this.
I have so many problems with Raspbian and since i only have this OS because
of OpenCV which i dont use anymore
i switch to Ubuntu Mate. I hope its more Qt5 friendly



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Segfault using PyQt5 with Raspbian

Xenoshell
Hello, here i am back again.
Now i use Ubuntu Mate Xenial 16.04, with PyQt5.9.2 and Qt5.9.3. Anyway the
code kinda works since i now also get a
segmentation fault.
Here the output of gdb:


I guess at least its a different segmentation fault since the output is not
equal. Anyone got an idea or is this thread dead?

Greets,

Xenoshell



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt