Glib issues with GIO_MODULE_DIR and gschemas.compiled

Hello here,

I have an general problem with understanding the runtime behavior of snaps.

I have an audio player which worked pretty fine when using core18. With core20 I am running into problems that gstreamer's souphttpsrc tells me that it cannot establish an ssl connection. I should install glib-networking.

But all files which are part of glib-networking are already in gnome-3-38-2004 or kde-framework-5-qt-5-15-3-core20.

But I have a workaround: First problem is GIO which cannot find usr/lib/x86_64-linux-gnu/gio/modules from the above mentioned extensions. If I brute-force the path with export GIO_MODULE_DIR=... I run into an issue that it cannot find the glib-2.0/schemas/gschemas.compiled. By copying it manually from the gnome-3-38-2004 extension into my XDG_DATA_HOME everything works.

So what am I doing wrong here?

  1. Should I copy these files during the snapcraft build process from the extensions? If yes, how?
  2. Or should I set some flag that allows my application to access files from other snaps during runtime?

For completeness I attached my snapcraft.yaml

name: sayonara
version: 1.8.0-beta-2
grade: stable
summary: Small and lightweight music player.
description: some description
confinement: strict
base: core20

apps:
  sayonara:
    adapter: full
    command: usr/bin/sayonara
    desktop: usr/share/applications/com.sayonara-player.Sayonara.desktop
    extensions:
      - gnome-3-38 
    plugs:
      - audio-playback
      - home
      - network
      - network-bind
      - network-manager-observe
      - opengl
      - optical-drive
      - removable-media
      - unity7
    slots:
      - mpris
    environment:
      # Use XDG-PORTALS, icon theme and open/save file dialogs.
      QT_QPA_PLATFORMTHEME: xdgdesktopportal

layout:
  /usr/share/sayonara:
    bind: $SNAP/usr/share/sayonara

parts:
  sayonara:
    source-type: local
    source: /root/sayonara
    plugin: cmake
    cmake-parameters:
      - -DCMAKE_BUILD_TYPE=Release
      - -DCMAKE_INSTALL_PREFIX=/usr
      - -DDISABLE_NATIVE_DIR_DIALOGS=1
      - -DCMAKE_CXX_COMPILER=clang++-10
      - -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold
    override-build: |
      snapcraftctl build
      sed -i 's|Icon=sayonara|Icon=${SNAP}/usr/share/icons/hicolor/256x256/apps/sayonara.png|g' $SNAPCRAFT_PART_INSTALL/usr/share/applications/com.sayonara-player.Sayonara.desktop
    build-packages:
      - binutils-gold
      - clang-10
      - cmake
      - glib-networking
      - git
      - libgstreamer-plugins-bad1.0-dev
      - libgstreamer-plugins-base1.0-dev
      - libgstreamer1.0-dev
      - libtag1-dev
      - pkg-config
      - qtbase5-dev
      - qttools5-dev
      - qttools5-dev-tools
      - libqt5svg5-dev
      - zlib1g-dev
    stage-packages:
      - libgpm2 # requred by gstreamer autoaudiosink
      - freeglut3
      - ffmpeg
      - glib-networking
      - gstreamer1.0-plugins-bad
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - gstreamer1.0-plugins-ugly
      - gstreamer1.0-libav
      - libqt5sql5-sqlite
      - libgcc1
      - libglib2.0-0
      - libgstreamer-plugins-base1.0-0
      - libgstreamer1.0-0
      - libqt5core5a
      - libqt5dbus5
      - libqt5network5
      - libqt5sql5
      - libqt5widgets5
      - libqt5xml5
      - libstdc++6
      - zlib1g
      - libslang2

  cleanup:
    after:
      - sayonara
    plugin: nil
    build-snaps: # List all content-snaps and base snaps you're using here
      - core20
      - gnome-3-38-2004
      - gtk-common-themes
      - kde-frameworks-5-qt-5-15-3-core20
    override-prime: |
      set -eux
      for snap in "core20" "gnome-3-38-2004" "gtk-common-themes" "kde-frameworks-5-qt-5-15-3-core20"; do  # List all content-snaps and base snaps you're using here
          cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
      done

Every help is highly appreciated. Thank you!

I tracked the problem down further and decided to open a new thread with a follow up question. This new question sums up the entire problem and is easier to understand.

This thread can be closed.