Can't launch the snap error while loading shared libraries: libpulsecommon-13.99.so: cannot open shared object file

hello guys i finally created my snap package but after launching it, it just throws this error /snap/textreader/x3/usr/bin/textreader: error while loading shared libraries: libpulsecommon-13.99.so: cannot open shared object file: No such file or directory

here is my yaml:

name: textreader # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '0.1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Read text using online/offline services # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots


parts:
  textreader:
    # See 'snapcraft plugins'
    source: .
    build-packages:
    - qtbase5-dev 
    - qtmultimedia5-dev
    stage-packages:
    - libasyncns0
    - libdouble-conversion3
    - libflac8
    - libfreetype6
    - libgl1
    - libglvnd0
    - libglx0
    - libgraphite2-3
    - libharfbuzz0b
    - libicu66
    - libogg0
    - libpcre2-16-0
    - libpng16-16
    - libpulse0
    - libqt5core5a
    - libqt5gui5
    - libqt5multimedia5
    - libqt5network5
    - libqt5widgets5
    - libsndfile1
    - libvorbis0a
    - libvorbisenc2
    - libx11-6
    - libxau6
    - libxcb1
    - libxdmcp6
    plugin: cmake
    cmake-parameters:
    - -DCMAKE_BUILD_TYPE=RELEASE
    - -DCMAKE_INSTALL_PREFIX=/usr/
    - -DCMAKE_PREFIX_PATH="${SNAPCRAFT_STAGE}/usr"


apps:
  textreader:
    command: usr/bin/textreader

I have libpulse0 in my dependencies whats the problem?

You need to set up several variables to integrate with the desktop session properly. The easiest way would be to add the kde-neon extension, though it is currently experimental for core20. That just involves adding

apps:
  textreader:
    command: usr/bin/textreader
    extensions: [kde-neon]

And running snapcraft --enable-experimental-extensions.

The alternative to the extensions is to generally use Snapcraft Desktop Helpers, which may be preferable if you absolutely hate the idea of using an experimental extension, need support on more architectures than extension provides, or the extension breaks you in other ways.

1 Like

I had the same libpulsecommon error when using core20 with my snap, and I solved it with:

apps:
  <app name>:
    environment:
      LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
1 Like

The LD_LIBRARY_PATH variable is the exact fix for this scenario, setting it is what the extensions and desktop helpers are doing that’s fundamentally helping with audio specifically. They do also solve a lot of other things too though so there’s a tendency to recommend them just because it solves entire categories of issues at once.

If you do have other related missing dependencies that you’ve staged but the app can’t find at runtime, then modifying the LD_LIBRARY_PATH variable is usually the correct approach.

1 Like

Good to know… I’m a total noob in snapcraft, so thanks for that info.

1 Like

I added this line but it didn’t work now it shows this:

WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
/snap/textreader/x6/usr/bin/textreader: /snap/textreader/x6/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /snap/textreader/x6/usr/bin/textreader)

So my assumption here is that kde-neon makes use of what’s known as a content snap, and the content snap includes various parts of QT 5.15 whereas the packages in your build-packages and stage-packages are QT 5.12 (because they come from Ubuntu 20.04 repo’s).

To keep trying with the kde-neon extension, I’d try just removing the QT packages explicitly listed. Namely:

build-packages:
    - qtbase5-dev 
    - qtmultimedia5-dev

And in the stage packages

    - libqt5core5a
    - libqt5gui5
    - libqt5multimedia5
    - libqt5network5
    - libqt5widgets5

Hopefully then, these should be included in the content snap and since there’s no duplication, just work fine.

If that isn’t the case, swapping to the Snapcraft Desktop Helpers might be worth trying out instead. They’re not as fancy but they don’t suffer from the problems of potentially mixing incompatible versions of QT.

1 Like

Man thank you I can finally run my app but it looks really ugly now(Windows 95)

it even does not respect the moues my default cursor and shows up some wired mouse cursor. could you please tell me how to fix this

Themes are a somewhat complicated situation with snaps at the moment and I’m not entirely sure how it all fits together, so I think it’s best someone elses advises you here. In theory the extension should have done the majority of the work for integrating common themes, but I don’t know for example how QT apps work in GTK environments or whether your theme might not be in the common bundle.

I do believe you’d probably have the option of forcing a specific theme for every user though if you’d prefer, likely by forcing environment variables, but again I’d have to defer to someone else here.

Good luck :slight_smile:

1 Like