Skip to content

Commit e1ceab4

Browse files
committed
#3470 snap: try to fix "no Qt platform plugin could be initialized" error
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent ea414c0 commit e1ceab4

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
arch="${SNAP_LAUNCHER_ARCH_TRIPLET:-x86_64-linux-gnu}"
4+
qt6_plugin_dir="$SNAP/usr/lib/$arch/qt6/plugins"
5+
qt6_qml_dir="$SNAP/usr/lib/$arch/qt6/qml"
6+
7+
export QT_PLUGIN_PATH="$qt6_plugin_dir${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
8+
export QT_QPA_PLATFORM_PLUGIN_PATH="$qt6_plugin_dir/platforms"
9+
export QML2_IMPORT_PATH="$qt6_qml_dir:$SNAP/lib/$arch${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}"
10+
export QML_IMPORT_PATH="$qt6_qml_dir${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}"
11+
12+
exec "$SNAP/usr/bin/QOwnNotes" --snap "$@"

build-systems/github/snap.qt6/snapcraft.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ layout:
2020

2121
apps:
2222
qownnotes:
23-
command: bin/desktop-launch $SNAP/usr/bin/QOwnNotes --snap
23+
# The desktop helper still configures Qt4/Qt5 plugin locations, so run a
24+
# small wrapper after it to point Qt6 at the staged plugin and QML paths.
25+
command: bin/desktop-launch $SNAP/wrapper.sh
2426
environment:
2527
DISABLE_WAYLAND: 1
2628
QT_QPA_PLATFORMTHEME: gtk3
@@ -107,8 +109,18 @@ parts:
107109
# libproxy1v5 ships libpxbackend-1.0.so in a private sub-directory;
108110
# the layout section above makes that path visible to the linker.
109111
- libproxy1v5
112+
# Bundle the Wayland QPA plugins explicitly; libqt6gui6t64 ships xcb,
113+
# but the Wayland backend lives in a separate package on Ubuntu 24.04.
114+
- qt6-wayland
110115
stage:
111116
- -usr/share/pkgconfig
117+
override-prime: |
118+
craftctl default
119+
arch_triplet="$(dpkg-architecture -q DEB_HOST_MULTIARCH)"
120+
platform_dir="${CRAFT_PRIME}/usr/lib/${arch_triplet}/qt6/plugins/platforms"
121+
test -f "${platform_dir}/libqxcb.so"
122+
test -f "${platform_dir}/libqwayland-egl.so"
123+
test -f "${platform_dir}/libqwayland-generic.so"
112124
after: [desktop-qt6]
113125

114126
desktop-qt6:
@@ -165,3 +177,9 @@ parts:
165177
plugin: nil
166178
stage-packages:
167179
- qt6-gtk-platformtheme
180+
181+
scripts:
182+
plugin: dump
183+
source: snap/local
184+
stage:
185+
- wrapper.sh

0 commit comments

Comments
 (0)