.so Errors with scrapcraft prime with "snapcraft --use-lxd"

Here is the output error. Unsure how to fix this. I am using “snapcraft --use-lxd”.

  Priming qt515 
    + snapcraftctl prime
    This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
    - libICE.so.6
    - libSM.so.6
    - libXcomposite.so.1
    - libXrandr.so.2
    - libXtst.so.6
    - libclang-6.0.so.1
    - libcups.so.2
    - libdouble-conversion.so.1
    - libevent-2.1.so.6
    - libfontconfig.so.1
    - libfreetype.so.6
    - libgdk-3.so.0
    - libgstapp-1.0.so.0
    - libgstaudio-1.0.so.0
    - libgstbase-1.0.so.0
    - libgstgl-1.0.so.0
    - libgstpbutils-1.0.so.0
    - libgstreamer-1.0.so.0
    - libgstvideo-1.0.so.0
    - libgtk-3.so.0
    - libharfbuzz.so.0
    - libhunspell-1.6.so.0
    - libicui18n.so.60
    - libicuuc.so.60
    - libinput.so.10
    - libjpeg.so.8
    - libmtdev.so.1
    - libmysqlclient.so.20
    - libnspr4.so
    - libnss3.so
    - libnssutil3.so
    - libodbc.so.2
    - libopenal.so.1
    - libpango-1.0.so.0
    - libpq.so.5
    - libsnappy.so.1
    - libsybdb.so.5
    - libtiff.so.5
    - libwayland-cursor.so.0
    - libwayland-egl.so.1
    - libxcb-icccm.so.4
    - libxcb-image.so.0
    - libxcb-keysyms.so.1
    - libxcb-render-util.so.0
    - libxcb-shm.so.0
    - libxcb-xinerama.so.0
    - libxcb-xinput.so.0
    - libxcb-xkb.so.1
    - libxkbcommon-x11.so.0
    - libxkbcommon.so.0
    - libxml2.so.2
    - libxslt.so.1
    These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
    Priming desktop-qt5 
    + snapcraftctl prime
    This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
    - libglut.so.3
    - libpsm_infinipath.so.1
    These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
    + cp /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml usr/share/glib-2.0/schemas
    + glib-compile-schemas usr/share/glib-2.0/schemas

The yaml file:

name: WICKRLCAPPNAME
version: WICKRVERSIONNUM
summary: Secure Messaging for Teams
description: >
  Wickr Secure Messaging

grade: stable
confinement: strict
base: core18
icon: snap/gui/WICKRLCAPPNAME.png

apps:

  WICKRLCAPPNAME:
    environment:
      DISABLE_WAYLAND: 1
      QT_QPA_PLATFORMTHEME: gtk3  
    command: desktop-launch alsa-launch WICKRAPPNAME
    plugs:
    - alsa
    - audio-playback
    - audio-record
    - desktop
    - desktop-legacy
    - x11
    - unity7
    - wayland
    - gsettings
    - opengl
    - home
    - removable-media
    - network
    - network-bind
    - network-manager
    - network-observe
    - network-control
    - camera
    - screen-inhibit-control
    - raw-usb

parts:
  qt515:
    plugin: dump
    source: /opt/qt51512/qt51512_5.15.12-wickr_amd64.deb
    source-type: deb
    stage-packages:
      - libdrm2
      - libegl1
      - libgbm1
      - libgl1
      - libglvnd0
      - libglx0
      - libpng16-16
      - libwayland-client0
      - libwayland-server0
      - libx11-6
      - libx11-xcb1
      - libxcb-glx0
      - libxcb-randr0
      - libxcb-render0
      - libxcb-shape0
      - libxcb-sync1
      - libxcb-xfixes0
      - libxdamage1
      - libxext6
      - libxfixes3


  wickr:
    source: ../../sample_app/ #../../WickrDesktopApp/ #this is relative to the "parts" directory that's created by snapcraft, different in lxc container
    project-files: ["../../../../sample_app/sample_app.pro"] #["../../../../WickrDesktopApp/desktop.pro"]  #this is relative to the "parts/wickr/src" directory, has for lxc
    plugin: qmakeppa
    after: [alsa-mixin, desktop-qt5]
    options: [WICKRQMAKECONFIGS]
    #override-build: |
      
      #sudo apt-get install apt-utils -y
      #sudo apt-get install software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-9 -y && sudo apt upgrade libstdc++6 -y
      #snapcraftctl build
    build-packages:
      - mesa-common-dev 
      - libgl1-mesa-dev 
      - libglu1-mesa-dev 
      # - libgl-dev
      - libgl1-mesa-glx
      - libstdc++6
      - gcc-9
    override-prime: |

      snapcraftctl prime

  alsa-mixin:
    plugin: nil
    source: https://github.com/diddlesnaps/snapcraft-alsa.git
    override-pull: |

      cat > asound.conf <<EOF
      pcm.!default {
          type pulse
          fallback "sysdefault"
          hint {
              show on
              description "Default ALSA Output (currently PulseAudio Sound Server)"
          }
      }
      ctl.!default {
          type pulse
          fallback "sysdefault"
      }
      EOF
      cat > alsa-launch <<EOF
      #!/bin/bash
      export ALSA_CONFIG_PATH="\$SNAP/etc/asound.conf"

      if [ -d "\$SNAP/usr/lib/alsa-lib" ]; then
          export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/alsa-lib"
      elif [ -d "\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib" ]; then
          export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib"
      fi
      export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio"
      export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/opt/qt51512/lib"

      # Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
      if [ -n "\$XDG_RUNTIME_DIR" ]; then
          pulsenative="pulse/native"
          pulseaudio_sockpath="\$XDG_RUNTIME_DIR/../\$pulsenative"

          if [ -S "\$pulseaudio_sockpath" ]; then
              export PULSE_SERVER="unix:\${pulseaudio_sockpath}"
          fi
      fi

      exec "\$@"
      EOF
      chmod +x alsa-launch
    override-build: |
      snapcraftctl build
      install -m644 -D -t $SNAPCRAFT_PART_INSTALL/etc asound.conf
      install -m755 -D -t $SNAPCRAFT_PART_INSTALL/snap/command-chain alsa-launch
    build-packages:
      - libasound2-dev
    stage-packages:
      - libasound2
      - libasound2-plugins

  ppa:
    plugin: nil
    override-pull: |
      QT_BASE_DIR=/opt/qt51512
      export QTDIR=$QT_BASE_DIR
      export PATH=$QT_BASE_DIR/bin:$PATH
      export LD_LIBRARY_PATH=$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
      export PKG_CONFIG_PATH=$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH

  desktop-qt5:
    source: https://github.com/spompelio/snapcraft-desktop-helpers.git
    source-commit: 6a4a132be505da069485473bb5f486afd69f28ba
    source-subdir: qt
    plugin: make
    after: [qt515, ppa]
    make-parameters: ["FLAVOR=qt5"]
    build-packages:
      - build-essential
      - dpkg-dev
    override-stage: |
        snapcraftctl stage
        strip --remove-section=.note.ABI-tag opt/qt51512/lib/libQt5Core.so.5
    override-prime: |
      snapcraftctl prime
      cp /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml usr/share/glib-2.0/schemas
      glib-compile-schemas usr/share/glib-2.0/schemas
    stage-packages:
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libgdk-pixbuf2.0-0
      - locales-all
      - xdg-user-dirs
      - libgtk2.0-0
      - libavahi-client3
      - libavahi-common3
      - libboost-all-dev
      - libcapnp-0.6.1 #libcapnp-0.7.0 
      - libcups2
      - libgbm1
      - libflac-dev
      - libxcomposite1
      - libxcursor1
      - libxi6
      - libxrender1
      - libxss1
      - libxtst6
      - libasyncns0
      - libfontconfig1
      - libhunspell-1.6-0 # libhunspell-1.7-0 
      - libnspr4
      - libnss3
      - libogg0
      - libpulse0
      - libsndfile1
      - libvorbis0a
      - libvorbisenc2
      - libxml2
      - libxslt1.1
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - libslang2
      - liborc-0.4-0
      - libxcb-xfixes0
      - libwayland-client0
      - libwayland-cursor0
      - libwayland-egl1
      - libglu1-mesa
      - libgl1-mesa-dri
      - libmtdev1
      - libdb5.3
      - libgl1-mesa-glx
      - libgpm2
      - libxcb-glx0
      - libxxf86vm1
      - libdouble-conversion1 #libdouble-conversion3
      - libxcb1
      - libsm6
      - libice6
      - libxrandr2
      - libxcb-xkb1
      - libxcb-render-util0
      - libxcb-randr0
      - libxcb-image0
      - libxcb-keysyms1
      - libxcb-icccm4
      - libxcb-shape0
      - libxcb-util1
      - libxcb-xinput0
      - libxcb-xinerama0
      - xkb-data
      - libxkbcommon0
      - libxkbcommon-x11-0
      - libuuid1
      - zlib1g
      - libsystemd0
      - liblzma5
      - liblz4-1
      - libgpg-error0
      - libsqlcipher0
      - libpsm-infinipath1
      - libstdc++6
      - xdg-utils
      - libc-bin

passthrough:
  layout:
    /etc/asound.conf:
      bind-file: $SNAP/etc/asound.conf
    /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib:
      bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
    /usr/share/alsa/alsa.conf:
      bind-file: $SNAP/usr/share/alsa/alsa.conf

plugs:
  # Support for common GTK themes
  # https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
  gsettings:
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
  browser-sandbox:
    interface: browser-support
    allow-sandbox: false

You can use the apt-file tool to reverse-search for the packages containing the respective libs… once you have the correct package name you can add it to your stage-packages for the respective part…

I will try that thanks! I was using the apt-file tool and indeed found libraries not included in the yaml file. However I did the apt-file search for libpsm_infinipath.so.1 and it comes out to libpsm-infinipath1, library that is included in the stage-packages. So unsure what to do about that library. You can see how libpsm_infinipath.so.1 is complained about in my first post and that libpsm-infinipath1 is included, for the yaml file

… but no for that specific part … so the linter complains about it …

if another part makes sure it ends up in the snap anyway you can indeed ignore it and do not need to seed it additionally in another part …

See here is my output:

Priming qt515 
+ snapcraftctl prime
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libxcb-xkb.so.1
- libxkbcommon-x11.so.0
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
Priming desktop-qt5 
+ snapcraftctl prime
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libpsm_infinipath.so.1
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
+ cp /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml usr/share/glib-2.0/schemas
+ glib-compile-schemas usr/share/glib-2.0/schemas
Priming wickr 
+ snapcraftctl prime
The command 'desktop-launch' for 'desktop-launch alsa-launch WickrProAlpha' was resolved to 'bin/desktop-launch'.
The command 'desktop-launch alsa-launch WickrProAlpha' has been changed to 'bin/desktop-launch alsa-launch WickrProAlpha'.
The 'passthrough' property is being used to propagate experimental properties to snap.yaml that have not been validated.
Snapping |                                                                                   
Snapped wickrproalpha_6.15.1_amd64.snap

But libpsm_infinipath1, libxcb-xkb1, libxkbcommon-x11-0 is included in the yaml file for the respective part. Why do I still get the warnings?

if your snap already includes these libs anyway (and does not show problems at runtime) you can indeed just ignore the messages as i said above …

if it really bothers you to see them, you can also disable the check altogether, see (but then you will miss if a new dependency is needed in case the software changes):