Building a Python Application that depends on PySide6 QtWebEngineWidgets with Briefcase
If you've run into this error, this is how you can fix it
by Danver Braganza on 2025-03-05
Introduction
I was recently using BeeWare’s Briefcase for a small project, when I ran into the following problem. freakboy3742 was able to help diagnose the problem and hone in on the solution. I thought I’d put it up on here as some content that might help the next weary traveller who wanders into the same trouble.
I was using the standard base image for Flatpak, and I had a dependency on
PySide6.QtWebEngineWidgets
. My app would build correctly, but when I tried to
run it, it would fail with:
libgssapi_krb5.so.2: cannot open shared object file: No such file or directory
Diagnosis
Although I was using the standard image for PySide, the QtWebEngineWidgets library required me to build mit-krb5 from source, to satisfy the requirements of the flatpak.
I needed to ensure that the custom steps to install mit-krb5 were added to the manifest.yml file, which would then be used by the flatpak-builder to actually build the module.
The fix
To do this, I added a modules_extra_content
section to my pyproject.toml, just
under the flatpak section:
[tool.briefcase.app.my-app.linux.flatpak]
flatpak_runtime = "org.kde.Platform"
flatpak_runtime_version = "6.7"
flatpak_sdk = "org.kde.Sdk"
modules_extra_content = """
- name: mit-krb5
buildsystem: simple
sources:
- type: archive
url: https://kerberos.org/dist/krb5/1.21/krb5-1.21.3.tar.gz
sha256: b7a4cd5ead67fb08b980b21abd150ff7217e85ea320c9ed0c6dadd304840ad35
build-commands:
- cd src && autoreconf -i # Ensure Autotools files are generated
- cd src && ./configure --prefix=/app --disable-static --enable-shared
- cd src && make -j$(nproc)
- cd src && make install
"""
Note the indentation for modules_extra_content
: these lines get stitched into
your manifest.yml
file, so they’re indented one layer in to match up.
After you’ve added these lines, make sure to run briefcase create linux
flatpak
so that the manifest.yml
gets regenerated.
Then you can briefcase build linux flatpak
and briefcase run linux flatpak
to verify that everything works.