[PyQt] Segfault using PyQt5 with Raspbian

David Boddie david at boddie.org.uk
Thu Nov 30 14:36:52 GMT 2017

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:




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:



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


More information about the PyQt mailing list