Missing Libraries for .deb using core22 base

I have a Java-based desktop application currently being distributed via a .deb. I’ve tested the .deb on Ubuntu 22 and all features are working as expected. I want to offer the application on the snap store as well.

The Java application is built using Maven which produces the .deb file. I wanted to take the easy path and just package that into a snap, mostly because I’m not familiar with Linux and the application is non-trivial with JavaFX involved.

This was my attempt (I removed the noise):

base: core22

apps:
  my-app:
    command: desktop-launch $SNAP/opt/my-app/bin/my-app
    desktop: opt/my-app/lib/my-app.desktop
    extensions: [gnome]
    plugs:
      - home
      - network
      - opengl
      - removable-media
      - unity7
      - x11
      - wayland
      - desktop
      - desktop-legacy
      - audio-playback
      - hardware-observe

parts:
  my-app:
    source: ./my-app.deb
    plugin: dump
    source-type: deb

When I run this I get the following output:

Generated snap metadata                                                                                                                                                                                    
Unable to determine library dependencies for 'opt/my-app/lib/runtime/lib/libawt_headless.so'                                                                                                           
Unable to determine library dependencies for 'opt/my-app/lib/runtime/lib/libawt_xawt.so'                                                                                                               
Unable to determine library dependencies for 'opt/my-app/lib/runtime/lib/libjawt.so'                                                                                                                   
Unable to determine library dependencies for 'opt/my-app/lib/runtime/lib/liblcms.so'                                                                                                                   
Unable to determine library dependencies for 'opt/my-app/lib/runtime/lib/libnio.so'                                                                                                                    
Lint warnings:                                                                                                                                                                                             
- library: opt/my-app/lib/runtime/lib/libavplugin-54.so: missing dependency 'libavcodec.so.54'. (https://snapcraft.io/docs/linters-library)                                                            
- library: opt/my-app/lib/runtime/lib/libavplugin-54.so: missing dependency 'libavformat.so.54'. (https://snapcraft.io/docs/linters-library)                                                           
- library: opt/my-app/lib/runtime/lib/libavplugin-56.so: missing dependency 'libavcodec.so.56'. (https://snapcraft.io/docs/linters-library)                                                            
- library: opt/my-app/lib/runtime/lib/libavplugin-56.so: missing dependency 'libavformat.so.56'. (https://snapcraft.io/docs/linters-library)                                                           
- library: opt/my-app/lib/runtime/lib/libavplugin-57.so: missing dependency 'libavcodec.so.57'. (https://snapcraft.io/docs/linters-library)                                                            
- library: opt/my-app/lib/runtime/lib/libavplugin-57.so: missing dependency 'libavformat.so.57'. (https://snapcraft.io/docs/linters-library)                                                           
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-56.so: missing dependency 'libavcodec-ffmpeg.so.56'. (https://snapcraft.io/docs/linters-library)                                              
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-56.so: missing dependency 'libavformat-ffmpeg.so.56'. (https://snapcraft.io/docs/linters-library)                                             
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-57.so: missing dependency 'libavcodec.so.57'. (https://snapcraft.io/docs/linters-library)                                                     
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-57.so: missing dependency 'libavformat.so.57'. (https://snapcraft.io/docs/linters-library)                                                    
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-58.so: missing dependency 'libavcodec.so.58'. (https://snapcraft.io/docs/linters-library)                                                     
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-58.so: missing dependency 'libavformat.so.58'. (https://snapcraft.io/docs/linters-library)                                                    
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-59.so: missing dependency 'libavcodec.so.59'. (https://snapcraft.io/docs/linters-library)                                                     
- library: opt/my-app/lib/runtime/lib/libavplugin-ffmpeg-59.so: missing dependency 'libavformat.so.59'. (https://snapcraft.io/docs/linters-library)                                                    
- library: libjpackageapplauncheraux.so: unused library 'opt/my-app/lib/libapplauncher.so'. (https://snapcraft.io/docs/linters-library)                                                                
- library: libawt_headless.so: unused library 'opt/my-app/lib/runtime/lib/libawt_headless.so'. (https://snapcraft.io/docs/linters-library)                                                             
- library: libawt_xawt.so: unused library 'opt/my-app/lib/runtime/lib/libawt_xawt.so'. (https://snapcraft.io/docs/linters-library)                                                                     
- library: libfontmanager.so: unused library 'opt/my-app/lib/runtime/lib/libfontmanager.so'. (https://snapcraft.io/docs/linters-library)                                                               
- library: libjavajpeg.so: unused library 'opt/my-app/lib/runtime/lib/libjavajpeg.so'. (https://snapcraft.io/docs/linters-library)                                                                     
- library: libjawt.so: unused library 'opt/my-app/lib/runtime/lib/libjawt.so'. (https://snapcraft.io/docs/linters-library)                                                                             
- library: libjfxwebkit.so: unused library 'opt/my-app/lib/runtime/lib/libjfxwebkit.so'. (https://snapcraft.io/docs/linters-library)                                                                   
- library: libjimage.so: unused library 'opt/my-app/lib/runtime/lib/libjimage.so'. (https://snapcraft.io/docs/linters-library)                                                                         
- library: libjli.so: unused library 'opt/my-app/lib/runtime/lib/libjli.so'. (https://snapcraft.io/docs/linters-library)                                                                               
- library: libjsig.so: unused library 'opt/my-app/lib/runtime/lib/libjsig.so'. (https://snapcraft.io/docs/linters-library)                                                                             
- library: libjsound.so: unused library 'opt/my-app/lib/runtime/lib/libjsound.so'. (https://snapcraft.io/docs/linters-library)                                                                         
- library: liblcms.so: unused library 'opt/my-app/lib/runtime/lib/liblcms.so'. (https://snapcraft.io/docs/linters-library)                                                                             
- library: libmanagement.so: unused library 'opt/my-app/lib/runtime/lib/libmanagement.so'. (https://snapcraft.io/docs/linters-library)                                                                 
- library: libmlib_image.so: unused library 'opt/my-app/lib/runtime/lib/libmlib_image.so'. (https://snapcraft.io/docs/linters-library)                                                                 
- library: libnet.so: unused library 'opt/my-app/lib/runtime/lib/libnet.so'. (https://snapcraft.io/docs/linters-library)                                                                               
- library: libnio.so: unused library 'opt/my-app/lib/runtime/lib/libnio.so'. (https://snapcraft.io/docs/linters-library)                                                                               
- library: libprefs.so: unused library 'opt/my-app/lib/runtime/lib/libprefs.so'. (https://snapcraft.io/docs/linters-library)                                                                           
- library: libsplashscreen.so: unused library 'opt/my-app/lib/runtime/lib/libsplashscreen.so'. (https://snapcraft.io/docs/linters-library)                                                             
- library: libsyslookup.so: unused library 'opt/my-app/lib/runtime/lib/libsyslookup.so'. (https://snapcraft.io/docs/linters-library)                                                                   
- library: libverify.so: unused library 'opt/my-app/lib/runtime/lib/libverify.so'. (https://snapcraft.io/docs/linters-library)                                                                         
- library: libzip.so: unused library 'opt/my-app/lib/runtime/lib/libzip.so'. (https://snapcraft.io/docs/linters-library)                                                                               
Command '['snap', 'pack', '--filename', 'my-app_2.0.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1.                      
Failed to execute pack in instance.                                                                                     

If I understand correctly, it’s complaining that I need to add libavcodec54 (and others) but these packages don’t appear to exist any more (or maybe aren’t available on core22)?

How can I resolve these dependencies on core22?

I’ve also tried core20 + gnome-3-38 combination and core18 + gnome-3-28 combination. Both of these report “file could not be opened successfully” I’m assuming because they don’t support the zst format that the .deb is using. The last option to try is to decompress the .deb and re-archive it in zip format (for example), and then try core18/20 again.

The command is wrong opt/my-app/bin/my-app. That’s it, you shouldn’t add anything else. Also, kindly try to build again ffmpeg-6.0, so the ffmpeg-sdk maintained by the snapcrafters can be used.

Thank you so much. I changed this:

apps:
  my-app:
    command: desktop-launch $SNAP/opt/my-app/bin/my-app

to:

apps:
  my-app:
    command: /opt/my-app/bin/my-app

And it successfully created the .snap. However, after debug installing it and doing some testing, everything works except for video playback - I’m assuming because of the missing libavcodec/libavformat binaries - though I could be wrong.

Here’s the challenge - these dependencies are Java FX 21 dependencies so I’m not sure how much control of that I have. I see that you mentioned building ffmpeg-6.0, could you clarify more what you meant? Did you mean to add ffmpeg-6.0 as a part that I need to stage or did you mean attempt to compile Java FX against ffmpeg-6.0 as part of the snap build?

I meant the second one, but not in the snap. Even though it can be compiled in the snap, but I think it’ll be easier to do so in the deb. What I suggest is to use the latest version of ffmpeg for your app while compilation if possible. If it’s possible to use ffmpeg-6 or later, then the addition of ffmpeg can be done differently, else it’ll be to pull those from jammy repos.

This is actually wrong (though it is interesting that snapcraft didn’t make the build fail and error out), you must remove the leading / from /opt

@ogra Thanks, I’ve made that change and that works as well.

@soumyaDghosh Thank you again for the help and pointing me in the right direction. For now I was able to just package the missing libraries and all testing checks out.

2 Likes