Qt (python) snap crashes on load or save with apparmor denials

Access to the accessibility bus is currently part of desktop-legacy. It’s not part of desktop because it is was not designed with confinement in mind: in particular it doesn’t distinguish between applications (that want to publish information about their UI and be controlled) and accessibility tools (that want to inspect applications and control them).

I would be surprised if lack of access to this bus is the cause of the segfault though.

Yes I did build on core18. It seems the kde-neon plug is still not supported for core20 so it’s not possible to use it for this.

1 Like

(Sorry I most probably confused it with another thread… the one that has core20 in the title. kde-neon was the strongest motivator for me too to revert to core18. Shutting up & good luck! I’ll likely need file access in a few weeks’ time too…)

I tried building on a 20.04 machine instead and the snap still seqfaults upon file dialog open/save. I was mistaken thinking it was ok on 20.10. It crashes on that too. The url for the project is https://github.com/dmnfarrell/tablexplore if any developer has time to try and test this.

It’s hard to give any advice without knowing why it is segfaulting. You could try running the app using --experimental-gdbserver as described in the following doc, and see if you can capture a stack trace of the crash:

Thanks, I tried this and this is the end of the gdb output. I guess it’s not that informative.

Reading /usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqtiff.so.debug from remote target...
Reading target:/usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqtiff.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwbmp.so from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwbmp.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/.debug/libqwbmp.so.debug from remote target...
Reading /usr/lib/debug//snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwbmp.so.debug from remote target...
Reading /usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwbmp.so.debug from remote target...
Reading target:/usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwbmp.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwebp.so from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwebp.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/.debug/libqwebp.so.debug from remote target...
Reading /usr/lib/debug//snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwebp.so.debug from remote target...
Reading /usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwebp.so.debug from remote target...
Reading target:/usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwebp.so.debug from remote target...
[Detaching after fork from child process 12920]
[Detaching after fork from child process 12921]
[New Thread 12797.12917]
[New Thread 12797.12918]
[New Thread 12797.12919]

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007f8e3ec27426 in ?? () from target:/lib/x86_64-linux-gnu/libc.so.6
(gdb) cont
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
1 Like

Rather than trying to continue from the segfault, try running the following commands:

set pagination off
thread apply all bt

The first will stop gdb from stopping for each screen full of data, and the second will produce a back trace for every thread in the program. This will probably be quite a lot of information, so perhaps use paste.ubuntu.com to save the output and then include the URL to the paste here.

1 Like

Ok thanks. traceback is here: https://paste.ubuntu.com/p/rDzx9BdjWt/

Are you able to do the thread apply all bt command after you get the segfault? In the paste, it looks like you produced a backtrace before the program segfaulted, which isn’t particularly interesting.

The idea is to find out what the program was doing at the point it generated the segfault.

Yes sorry I was using it wrong. Here’s the trace after the segfault:

(gdb) thread apply all bt

Thread 4 (Thread 15525.15625):
#0  0x00007f1674b1acb9 in poll () from target:/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f166080e5c9 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f166080e6dc in g_main_context_iteration () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f1663c321cc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#4  0x00007f1663bd521a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#5  0x00007f16639eb844 in QThread::exec() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#6  0x00007f1657d1ffd5 in QDBusConnectionManager::run() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5DBus.so.5
#7  0x00007f16639ecb35 in QThreadPrivate::start(void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#8  0x00007f16747ee6db in start_thread () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#9  0x00007f1674b2771f in clone () from target:/lib/x86_64-linux-gnu/libc.so.6

Thread 3 (Thread 15525.15624):
#0  0x00007f16747f4fb9 in pthread_cond_timedwait@@GLIBC_2.3.2 () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f16639f35a4 in QWaitCondition::wait(QMutex*, QDeadlineTimer) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#2  0x00007f16639f08d1 in QThreadPoolThread::run() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#3  0x00007f16639ecb35 in QThreadPrivate::start(void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#4  0x00007f16747ee6db in start_thread () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007f1674b2771f in clone () from target:/lib/x86_64-linux-gnu/libc.so.6

Thread 2 (Thread 15525.15623):
#0  0x00007f1674b1acb9 in poll () from target:/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f165d6b6747 in ?? () from target:/snap/tablexplore/x1/usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f165d6b836a in xcb_wait_for_event () from target:/snap/tablexplore/x1/usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f16584f37b0 in QXcbEventQueue::run() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5XcbQpa.so.5
#4  0x00007f16639ecb35 in QThreadPrivate::start(void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#5  0x00007f16747ee6db in start_thread () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f1674b2771f in clone () from target:/lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 15525.15525):
#0  0x00007f1674ab7426 in ?? () from target:/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f164f9e9138 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqxdgdesktopportal.so
#2  0x00007f164f9e9bf0 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqxdgdesktopportal.so
#3  0x00007f165c0140d0 in QDialogPrivate::setNativeDialogVisible(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#4  0x00007f165c025eb2 in QFileDialog::setVisible(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#5  0x00007f165c014ef1 in QDialog::exec() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#6  0x00007f165c027361 in QFileDialog::getSaveFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QStringList const&) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#7  0x00007f165c0274bf in QFileDialog::getSaveFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlags<QFileDialog::Option>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#8  0x00007f165c782a9f in Sbk_QFileDialogFunc_getSaveFileName () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#9  0x000000000050a4a5 in ?? ()
#10 0x000000000050cc96 in _PyEval_EvalFrameDefault ()
#11 0x00000000005095c8 in ?? ()
#12 0x000000000050a2fd in ?? ()
#13 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#14 0x0000000000507be4 in ?? ()
#15 0x0000000000509900 in ?? ()
#16 0x000000000050a2fd in ?? ()
#17 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#18 0x0000000000507be4 in ?? ()
#19 0x0000000000588c8b in ?? ()
#20 0x000000000059fd0e in PyObject_Call ()
#21 0x00007f1664142d2f in PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/libpyside2.abi3.so.5.15
#22 0x00007f1664147cdf in PySide::GlobalReceiverV2::qt_metacall(QMetaObject::Call, int, void**) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/libpyside2.abi3.so.5.15
#23 0x00007f1663c0ef97 in void doActivate<false>(QObject*, int, void**) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#24 0x00007f165be26672 in QAction::triggered(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#25 0x00007f165be28a9e in QAction::activate(QAction::ActionEvent) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#26 0x00007f165bf19a78 in QAbstractButtonPrivate::click() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#27 0x00007f165bf19b95 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#28 0x00007f165bffca8a in QToolButton::mouseReleaseEvent(QMouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#29 0x00007f165be6a740 in QWidget::event(QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#30 0x00007f165bffcb59 in QToolButton::event(QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#31 0x00007f165be2c43c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#32 0x00007f165be331f8 in QApplication::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#33 0x00007f165c6c2325 in QApplicationWrapper::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#34 0x00007f1663bd6808 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#35 0x00007f165be3253a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#36 0x00007f165be83fe8 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#37 0x00007f165be86cf3 in QWidgetWindow::event(QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#38 0x00007f165be2c43c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#39 0x00007f165be32f20 in QApplication::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#40 0x00007f165c6c2325 in QApplicationWrapper::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#41 0x00007f1663bd6808 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#42 0x00007f165e4ed56d in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Gui.so.5
#43 0x00007f165e4ee955 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Gui.so.5
#44 0x00007f165e4ca8ab in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Gui.so.5
#45 0x00007f16584f469a in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5XcbQpa.so.5
#46 0x00007f166080e417 in g_main_context_dispatch () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#47 0x00007f166080e650 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 0x00007f166080e6dc in g_main_context_iteration () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007f1663c321cc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#50 0x00007f1663bd521a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#51 0x00007f1663bde1d3 in QCoreApplication::exec() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#52 0x00007f165c6bfd98 in Sbk_QApplicationFunc_exec_ () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#53 0x000000000050a461 in ?? ()
#54 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#55 0x00000000005095c8 in ?? ()
#56 0x000000000050a2fd in ?? ()
#57 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#58 0x0000000000507be4 in ?? ()
#59 0x000000000050ad03 in PyEval_EvalCode ()
#60 0x0000000000634e72 in ?? ()
#61 0x0000000000634f27 in PyRun_FileExFlags ()
#62 0x00000000006386df in PyRun_SimpleFileExFlags ()
#63 0x0000000000639281 in Py_Main ()
#64 0x00000000004b0dc0 in main ()

I think this part of the back trace points at the problem:

#2  0x00007f164f9e9bf0 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqxdgdesktopportal.so
#3  0x00007f165c0140d0 in QDialogPrivate::setNativeDialogVisible(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5

You are using a Qt plugin provided by the kde-frameworks-5-core18 snap (brought in through the use of the kde-neon extension) with a libQt5Widgets that seems to be bundled with the PySide2 Python extension. I suspect that these are from different Qt versions, leading to a segfault (the Qt plugin interface is considered private, and does change between Qt versions that are otherwise binary compatible).

I’m not sure of the best way to resolve this. Maybe you could try the following:

  1. in your requirements.txt, lock the version of PySide2 to the Qt version contained in kde-frameworks-5-core18.
  2. In your snapcraft.yaml, use the stage: stanza of your part to exclude the bundled copy of Qt that PySide2 installs (which should also slim down your snap significantly).

Hope that helps.

I changed PySide2 to use 5.12 and added this to the yaml:

    stage:
        - -lib/python3.6/site-packages/PySide2/Qt

However now it can’t seem to pick up Qt at all when the program runs:

Qt: Session management error: Could not open network socket
Traceback (most recent call last):
  File "/snap/tablexplore/x1/bin/tablexplore", line 33, in <module>
    sys.exit(load_entry_point('tablexplore==0.3.0', 'gui_scripts', 'tablexplore')())
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 954, in main
    aw = Application(**args)
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 106, in __init__
    self.newProject()
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 357, in newProject
    self.addSheet('dataset1')
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 633, in addSheet
    columnwidth=core.COLUMNWIDTH, timeformat=core.TIMEFORMAT)
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/core.py", line 87, in __init__
    self.splitter = QSplitter(Qt.Vertical, self)
NameError: name 'Qt' is not defined

Do I need some kind of link to the Qt libraries in the kde-frameworks-5-core18 snap? I assume this is handled automatically. Maybe it’s the way PySide2 works.

(Sorry, not sure it’s any new info, but writing from experience rather than Linux-specific knowledge … are you building on an actual Ubuntu 18 or a Ubuntu 20? Things started to work for me thence, i.e. once the full process took place on a Ubuntu 18. Not when packaging using core18 on the same Ubuntu 20 PC - trying to keep changes minimal as the interplay between things seems fragile, I didn’t try to migrate the Python packaging/compilation process into snapcraft, so this seemed the “best” way (at least for a first attempt! but it more or less worked) to ensure binary compatibility - which Windows DLL’s would want I believe, not sure about .so’s - if ever needed. My process is probably awkward, but you never know, we might be in the same shoes, or similar errors might occur.)

Yes I build on Ubuntu 20.10. It would seem to defeat the purpose of using multipass etc if you had to build on a specific version of ubuntu to get it working. But I might try this as a last resort…! Thanks.

1 Like

Maybe try excluding lib/python3.6/site-packages/PySide2/Qt/lib? I’m not overly familiar with the directory layout of the wheel distribution of PySide, but that appears to be where it stored libQt5Widgets at least. You want to keep the Python modules and Python extensions, but exclude actual Qt.

1 Like

(I have to be very delivery-oriented, and to the right market, as I am “low on numbers”. The Linux market showed no signs of life - Win & Mac seem better (sniff) - while there’s been a significant amount of hurdles and productivity loss from my perspective with deploying my project, even in relation to snapping - possibly my bad … so I kept the step yielding my zipped PyInstaller results separate, in case I’d have to back off to only delivering to recent LTS Ubuntus as earlier planned. Now I am only packaging one of those with snapcraft as I treat the Snap Store as a desired distribution platform, not sure if for any other reason.

Payload information for you perhaps too: multipass may not be an absolute requirement, snapcraft --destructive-mode should allow e.g. me to get around the nested-virtualization caveat I ran into earlier with my (then VM) build U18 + VirtualBox + snapcraft, also allow for a saner build process, where I’ll likely be able to inspect/debug etc. a relevant final product experience in a more usual way pre snapping.

But I do hope you guys get things sorted the proper way and I’ll have the honor of peeking into some serious system level debugging on Linux nevertheless!)

Tried this and now I get this:

    self.splitter = QSplitter(Qt.Vertical, self)
NameError: name 'Qt' is not defined
python3: relocation error: /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqicns.so: symbol _ZdlPvm version Qt_5 not defined in file libQt5Core.so.5 with link time reference

Okay. It looks like using the binary PySide2 wheel from pypi will not work with the Qt 5 libraries from the kde-neon extension. I’m kind of surprised that PySide would be expecting Qt to provide that particular symbol:

$ echo _ZdlPvm | c++filt
operator delete(void*, unsigned long)

On modern Linux systems (at least as far back as Ubuntu 16.04), that symbol is provided by libstdc++ so a Qt built in that environment won’t include it. As the Qt included with PySide2 exports it with the “Qt_5” symbol version though, the Python extension won’t use the version provided by libstdc++.

Realistically, there are two options here:

  1. Stop using the kde-neon extension and depend entirely on the Qt distributed with the PyPI version of PySide2. This would mean redoing all the integration work the extension handles for you.

  2. Use a version of PySide2 compiled against Ubuntu 18.04’s Qt binaries.

For (2), that probably means building PySide2 from source as a second part in your Snapcraft recipe, since there are no deb packages of PySide2 in the 18.04 repository that you could reference via stage-packages. It is in the 20.04 repository, but the kde-neon extension does not yet support core20 snaps :frowning:

There are packages of PyQt5 in 18.04 though (as python3-pyqt5), which is mostly compatible with PySide2. Note that it comes under a different license though, so might not be appropriate on those grounds.

1 Like

I think the easiest thing is to enable the application to use PyQt5 when it’s present as they are basically interchangeable. I can then use the deb package and ignore the PySide2 package from pip. Is there a directive to omit dependencies that are in the setup.py file?

I can confirm that this now works when PyQt5 is used instead. I just remove the PySide2 dependency from setup.py temporarily when building so it will not be included in the snap.

I use these imports to allow using either library:

try:
    from PySide2 import QtCore
    from PySide2.QtWidgets import *
    from PySide2.QtGui import *
    from PySide2.QtCore import QObject, Signal, Slot
except:
    from PyQt5 import QtCore
    from PyQt5.QtWidgets import *
    from PyQt5.QtGui import *
    from PyQt5.QtCore import pyqtSignal as Signal, pyqtSlot as Slot
2 Likes