diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 18d9422..549cb9e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -68,6 +68,15 @@ apps: PATH: $SNAP/usr/bin:$SNAP/bin:$PATH # PortAudio opens ALSA first. Point at snap-local config that routes to Pulse. ALSA_CONFIG_PATH: $SNAP/etc/asound.conf + # core24 gnome-46-2404: desktop-launch rebuilds gdk-pixbuf-loaders.cache + # by running query-loaders, which picks the SVG loader from the first + # LD_LIBRARY_PATH entry ending in /$CRAFT_ARCH_TRIPLET. Stage-packages + # (via libavcodec and friends) put a gdk-pixbuf tree without + # libpixbufloader_svg.so at $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET, ahead of + # gnome-platform. About page and other GdkPixbuf SVG loads then fail + # with "Image type svg is not supported". + # https://forum.snapcraft.io/t/missing-svg-support-for-gtk3-in-core24/48851 + LD_LIBRARY_PATH: $SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH # Make ALSA data/plugins visible at the paths libasound expects. layout: diff --git a/tests/test_snap_packaging.py b/tests/test_snap_packaging.py index 425cd8f..b6d97ed 100644 --- a/tests/test_snap_packaging.py +++ b/tests/test_snap_packaging.py @@ -31,6 +31,22 @@ def test_snapcraft_recipe_and_gui_assets() -> None: assert SNAP_PNG.stat().st_size > 0 +def test_snap_puts_gnome_platform_first_on_ld_library_path() -> None: + """core24 gdk-pixbuf finds libpixbufloader_svg.so only if gnome-platform wins. + + Stage-packages pull a second gdk-pixbuf (no SVG loader) into + $SNAP/usr/lib/. desktop-launch's query-loaders walks the first + LD_LIBRARY_PATH entry that ends in that triplet, so gnome-platform must + come first or About-page SVGs fail with "Image type svg is not supported". + """ + doc = yaml.safe_load(SNAPCRAFT_YAML.read_text(encoding="utf-8")) + env = (doc.get("apps") or {}).get("vocalinux", {}).get("environment") or {} + ld_path = env.get("LD_LIBRARY_PATH") + assert isinstance(ld_path, str) + assert ld_path.startswith("$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET:") + assert ld_path.endswith(":$LD_LIBRARY_PATH") + + def test_snap_strips_pygobject_and_uses_gnome_gi() -> None: """Pip must not build PyGObject; GI comes from the gnome extension.""" text = SNAPCRAFT_YAML.read_text(encoding="utf-8")