wxWidgets Dependency2

Greetings: I am trying to create a snap for an app dependent on wxWidgets. Here is the yaml I am using:

base: core18

parts:
  # The wxWidgets SDK Stage Snaps
  # https://forum.snapcraft.io/t/the-wxwidgets-sdk-stage-snaps/10877
  wxwidgets-sdk:
    plugin: nil
    stage-packages:
      - libpng16-16
      - libwxgtk3.0-0v5
      - libcairo2 
    stage-snaps:
      - wxwidgets-sdk-gtk3
    filesets:
      crash-dialog-support:
      - usr/bin/*addr2line
      library-shared:
      - '**/lib/**/*.so*'
    prime:
      - $crash-dialog-support
      - $library-shared
    
  tdhnet:
    plugin : dump
    source: TdhNet_linux64.zip
    stage-packages:
      - libwxgtk3.0-0v5
      - libcairo2 
    after:
      - wxwidgets-sdk
  

apps:
  tdhnet:
    command: TdhNet_launcher.sh 

plugs:
  # For snaps with a graphical user interface:
  desktop:
  desktop-legacy:
  x11:
  unity7:
  wayland:
  gnome:
  gtk3:

  # Storage access
  home:
  removable-media: # Non-A/C

  # Network access
  #network:

and here are the error messages:

$ snapcraft
Launching a VM.
Skipping pull wxwidgets-sdk (already ran)
Skipping pull tdhnet (already ran)
Skipping build wxwidgets-sdk (already ran)
Skipping build tdhnet (already ran)
Skipping stage wxwidgets-sdk (already ran)
Skipping stage tdhnet (already ran)
Priming wxwidgets-sdk 
+ snapcraftctl prime
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libgdk-3.so.0
- libgstreamer-1.0.so.0
- libgstvideo-1.0.so.0
- libgtk-3.so.0
- libwebkit2gtk-4.0.so.37
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
Priming tdhnet 
+ snapcraftctl prime
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- libgdk-3.so.0
- libgtk-3.so.0
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.
Snapping |                                                                                                   
Snapped tdhnet_22.11.26_amd64.snap

https://packages.ubuntu.com/search?searchon=contents&keywords=libgdk-3.so.0&mode=exactfilename&suite=kinetic&arch=any

If you add libgtk-3-0 to stage-packages then you can resolve the issue for this shared object. Same for the other files.

The Ubuntu package search page is super helpful. You can do the same with apt commands on the command line too.

Very good, thanks, that got snapcraft to complete. But now when I install and run the app, some standard libraries are not found. Using Synaptic, I see quite a few packages for standard c/c++ libraries. Is there a best way to resolve this? Thanks, again.

$ snap install --devmode tdhnet_23.03.13_amd64.snap
2023-03-14T13:12:04-07:00 INFO snap "tdhnet" has bad plugs or slots: gnome (unknown interface "gnome"); gtk3 (unknown
interface "gtk3")
tdhnet 23.03.13 installed
WARNING: There is 1 new warning. See 'snap warnings'.
tim@SanDisk-1tb:/media/tim/ntfs/Snaps/TdhNet$ tdhnet
./TdhNet_linux: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./TdhNet_linux)
./TdhNet_linux: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./TdhNet_linux)
./TdhNet_linux: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./TdhNet_linux)
./TdhNet_linux: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./TdhNet_linux)
./TdhNet_linux: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./TdhNet_linux)
./TdhNet_linux: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./TdhNet_linux)
./TdhNet_linux: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./libTdhVGbase.so)
./TdhNet_linux: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./libTdhCairo.so)

It looks like you’re using pre-built binaries that require newer library versions than those provided by core18, have you tried to use base core22 instead?

Thanks for the reply. When I try running with core20 or core22, I get the following error:

*emphasized text*snapcraft prime --shell
Launching instance...                                                                                                  
Stage package not found in part 'wxwidgets-sdk': libwxgtk3.0-0v5.                                                      
Failed to execute prime in instance.                                                                                   
Full execution log: '/home/tim/.local/state/snapcraft/log/snapcraft-20230315-181933.713722.log'

It seems that the stage package libwxgtk3.0-0v5 needs updating to work with cores > 18. I’m willing to work on that but I could use some guidance. A reference to how the current version was created would be a good start. Can anyone point me in the right direction? Thanks, Tim

Does your app work with libwxgtk3.0-gtk3-0v5? This package is in 18.04/20.04 and 22.04. It looks very similar with the exception of gtk2 stuff missing.

https://packages.ubuntu.com/bionic/libwxgtk3.0-gtk3-0v5 vs https://packages.ubuntu.com/bionic/libwxgtk3.0-0v5

Very good, this is progress. Using libwxgtk3.0-gtk3-0v5 and core22 I can create a snap. But now I have a problem with the launcher.sh, shown below. It is supposed to start the app and specify a directory where a database can be created and accessed (using a user specified parameter, if provided).

cd $SNAP
exec "./TdhNet_linux" "$SNAP_USER_DATA" "$@"
$ tdhnet
cannot snap-exec: cannot exec "/snap/tdhnet/x7/TdhNet_launcher.sh": exec format error

if I cd into /snap/tdhnet/x7 I can start the app, but without having a directory for the database the app won’t work properly. Is there some way I can modify the launcher.sh to work in this environment?

Thanks, Tim

Try adding bash to stage packages. I’m sure there’s a warning about no interpreter for .sh files somewhere in the thousands of log lines.

is it a copy/paste omission that you do not have #! /bin/sh as the first line in your script ?

Thanks, again. The launcher.sh is working. When the snap is run, I get the errors shown below. I suspect this is due to the lack of gtk2. If so, then I am back to needing to update libwxgtk.3.0-0v5 for cores > 18. I will look into this as time allows. For the time being, I have gotten the app to compile under Ubuntu 18.04 and created a snap using core18, but this is not a long term solution as these resources will become ever more dated.

I appreciate all the help, Tim

$ tdhnet
Gtk-Message: 22:28:08.153: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:28:08.163: Failed to load module "canberra-gtk-module"

(TdhNet_linux:121675): Gtk-WARNING **: 22:28:08.353: Could not find the icon 'user-home-symbolic-ltr'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases

(TdhNet_linux:121675): Gtk-WARNING **: 22:28:08.353: Could not load a pixbuf from /org/gtk/libgtk/icons/16x16/status/image-missing.png.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Aborted (core dumped)

I have seen this issue before, and it was in a gtk2.0 app but it was AppImage related, not snap related.

I learned that the issue occurrs because of a change in image format support in the gdk-pixbuf package – it is no longer supporting PNG or JPEG images by default. My issue was that image support from the host was leaking into my container so even though I had the correct packages to support PNG/JPEG the generated loaders.cache file was wrong.

I have no idea what the wxwidgets-sdk-gtk3 stage-snap supports be default.