Lib exists, but I am getting : error while loading shared libraries

My question is how best to troubleshoot this, and of course how to fix it.

The library libpulsecommon-16.1.so exists in the created snap. When I usquash it is here: \wsl.localhost\Ubuntu\home\adsiltia\space-nerds-in-space\squashfs-root\usr\lib\x86_64-linux-gnu\pulseaudio

When I: snap run snis I get: /snap/snis/x1/bin/snis_client: error while loading shared libraries: libpulsecommon-16.1.so: cannot open shared object file: No such file or directory

It was created with command line: sudo snap install --dangerous --devmode snis_1.0.8_amd64.snap

And yaml:

name: snis base: core24 version: 1.0.8 summary: Space bridge simulator description: | Space bridge simulator

grade: devel confinement: devmode

parts: snis: source: GitHub - smcameron/space-nerds-in-space: Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space plugin: make make-parameters: - PREFIX= #must clear default . in makefile or will mangle command path - DOWNLOAD_OPUS=no #- WITHVOICECHAT=yes # override-build: | # make WITHVOICECHAT=yes #DOWNLOAD_OPUS=yes stage-packages: - pkg-config - portaudio19-dev - pulseaudio - libvorbis-dev - libsdl2-dev - libsdl2-2.0-0 - liblua5.2-dev # .3 fails? - libglew-dev - libttspico-utils - libssl-dev - libcrypt-dev - libcurl4-gnutls-dev - libopus0 - libopus-dev - libubsan1 - libpulse-dev - libpulse0 build-packages: - libpng-dev

apps: snis: command: bin/snis_client plugs: - system-observe

plugin: dump

same issue.

It seems like snapcraft can’t figure out where the library is or where to put it correctly. It’s there in the package.

Better format for yaml I hope:


My question is how best to troubleshoot this, and of course how to fix it.

The library  libpulsecommon-16.1.so  exists in the created snap.
When I usquash it is here:
\\wsl.localhost\Ubuntu\home\adsiltia\space-nerds-in-space\squashfs-root\usr\lib\x86_64-linux-gnu\pulseaudio

When I:
snap run snis
I get:
/snap/snis/x1/bin/snis_client: error while loading shared libraries: libpulsecommon-16.1.so: cannot open shared object file: No such file or directory

It was created with command line:
sudo snap install --dangerous --devmode snis_1.0.8_amd64.snap

And yaml:

name: snis
base: core24
version: 1.0.8
summary: Space bridge simulator
description: |
  Space bridge simulator

grade: devel
confinement: devmode

parts:
  snis:
    source: https://github.com/smcameron/space-nerds-in-space.git
    plugin: make
    make-parameters:
      - PREFIX= #must clear default . in makefile or will mangle command path
      - DOWNLOAD_OPUS=no
      #- WITHVOICECHAT=yes
     #    override-build: |
     #      make WITHVOICECHAT=yes
     #DOWNLOAD_OPUS=yes
    stage-packages:
      - pkg-config
      - portaudio19-dev
      - pulseaudio
      - libvorbis-dev
      - libsdl2-dev
      - libsdl2-2.0-0
      - liblua5.2-dev    # .3 fails?
      - libglew-dev
      - libttspico-utils
      - libssl-dev
      - libcrypt-dev
      - libcurl4-gnutls-dev
      - libopus0
      - libopus-dev
      - libubsan1
      - libpulse-dev
      - libpulse0
    build-packages:
       - libpng-dev

apps:
   snis:
     command: bin/snis_client
     plugs:
       - system-observe

Please add three backticks ``` in the line before and after pasted code to put into posts, else it becomes unreadable and the formatting gets lost which, especially for yaml is rather essential…

EDIT: ah, you figured it out already :slightly_smiling_face:

1 Like

You want to add something like:

environment:
  # pulseaudio
  LD_LIBRARY_PATH: ${SNAP}/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio

To your apps section to extend the library search path of the snap, sadly lib pulse puts itself in a subdir that isn’t in the standard path added to snap applications

thanks.

apps:
   snis:
     command: bin/snis_client
     plugs: 
       - system-observe
     environment:
       LD_LIBRARY_PATH: ${SNAP}/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio

Fixed that lib issue, on to the next lib error!

1 Like

I had to use: LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}:${SNAP}/usr/lib/x86_64-linux-gnu/pulseaudio

$SNAPCRAFT_ARCH_TRIPLET produces nothing when I test in the shell sudo snap run --shell snis

No, snapcraft replaces it with the correct triplet at build time and puts it into the resulting snap.yaml in your snap, it isn’t a runtime variable but important to make your snap run on different architectures… (Though I think in newer snapcraft it got slightly renamed, you should see a suggestion to update it to the new format during build)

For base: core24 snaps, the variable is instead $CRAFT_ARCH_TRIPLET_BUILD_FOR, see here.

1 Like