WxPython Snap: How to get libgpm.so.2?

Hello everyone! I’ve tried to create snaps for a few months now, but I think there is a hurdle I cannot cross right now. I’ve developed an application using WxPython that is supposed to play audio and video files when the user wants to.

Here’s my snapcraft.yaml currently:

grade: stable
confinement: strict
base: core18

apps:
    my-app:
        command: python3 $SNAP/src/my-app.py
        extensions: [gnome-3-28]
        plugs:
            - home
        
parts:
  source-copy:
    plugin: dump
    source: .
  my-app:
    plugin: python
    python-version: python3
    source: .
    stage-packages:
        - libssl-dev
        - libjpeg-dev
        - libtiff-dev
        - libsdl1.2-dev
        - libnotify-dev
        - freeglut3
        - ibus-gtk3
        - libwebkitgtk-3.0-0
        - zlib1g
        - libsm6
        - libpulse0
        - libslang2
        - libsdl1.2debian
        - python3-wxgtk4.0
        - python3-wxgtk-media4.0
        - libgstreamer1.0-0
        - libgstreamer-plugins-base1.0-0

When I use this, the snap is created without much problem, but this warning appears:

This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libgpm.so.2
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.

For a while, I was just ignoring this warning, since my application was still working, but when I try to use wx-media, the program tries to find libgpm.so.2, but is unable to. The exact warning:

Failed to load plugin '/snap/my-app/x1/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaasink.so': libgpm.so.2: cannot open shared object file: No such file or directory

I’ve tried to add a lot of different stage packages in order to fix the problem, but so far I found nothing. If anyone has an idea to fix this problem, don’t hesitate to share it here. Thank you for reading this.

I suppose you tried to stage libgpm2? Probably yes, but asking just in case.

1 Like

Yes, I tried to stage it, but so far I haven’t found any way to do it.

What happens if you just add the package to stage-packages?

1 Like

It isn’t able to find it, and it therefore stops the process with an error. I tried to see if there was a way to add it from somewhere else, but so far my Internet searches were not very informative.

Please provide the actual error message for further investigation.

Also if possible please provide a minimal wxpython + wx-media code sample with a snapcraft recipe that can reproduce this problem at our end.

Here’s a minimalist WxPython + WxMedia program that opens the video ~/Downloads/testfile.webm:

#!/usr/bin/env python
import wx
import wx.media
import os.path

class MyApp(wx.Frame):
	def __init__(self):
        path = os.path.expanduser("~/Downloads/testfile.webm")
        super(MyApp, self).__init__(None, title="Test application")
	    self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
	
	    self.panel = wx.Panel(self,size=(800, 440))
	    self.panel.Layout()
	
	    self.media = wx.media.MediaCtrl(self.panel, size=(800, 440))
	    self.media.Bind(wx.media.EVT_MEDIA_LOADED, lambda _: self.media.Play())
	    self.media.Bind(wx.media.EVT_MEDIA_FINISHED, lambda _: self.Destroy())
	    self.media.Load(path)
	
	    self.SetMinSize((800, 470))
	    self.SetMaxSize((800, 470))
	
	    self.Show()

 if __name__ == '__main__':
    app = wx.App()
    app.SetAppName("myApp")
    app.SetTopWindow(MyApp())
    app.MainLoop()

For the snapcraft, I will use the same snapcraft.yaml presented above, with and without libgmp2.

Snapcraft project structure:

snap/
--- gui/
------ my-app.desktop
------ logo.png
src/
--- my-app.py
setup.py -------------> Just a regular setup.py, nothing much here
snapcraft.yaml

When libgmp2 is added to my-app stage-packages:

Failed to fetch stage packages: Error downloading packages for part 'my-app': The package 'libgmp2' was not found..

When libgmp2 is not added, the snap is created correctly but with this warning:

This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libgpm.so.2
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.

Then you can install the snap, and try to run the application, but this warning will be displayed, and the video will not play:

(gst-plugin-scanner:8830): GStreamer-WARNING **: 09:31:44.510: Failed to load plugin '/snap/my-app/x1/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaasink.so': libgpm.so.2: cannot open shared object file: No such file or directory
1 Like

Probably because it is called gpm2, not gmp2 :wink:

2 Likes

…Well I feel stupid lol… Thank you @ogra, @Lin-Buo-Ren and @cmatsuoka for answering me.

1 Like