Libasound_module_ctl_pipewire.so error on core22 when running snap

I am building a core22 image on an Ubuntu 24.04.4 LTS OS with --use-lxd from a prebuilt directory created with cmake with my video player. The player uses RtAudio which can run with alsa, pulseaudio or jack.

The snapcraft build succeeds. However, upon running I get an alsa-lib error when loading plugins (audio, however does work):

ALSA lib dlmisc.c:337:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_ctl_pipewire.so (/snap/mrv2/x1/bin/../usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_ctl_pipewire.so: cannot open shared object file: No such file or directory)

Here’s my basic snapcraft.yaml.in:

name: mrv2
version: '@VERSION@'
summary: Professional review tool for the VFX, animation and CGI industries.
description: |
  mrv2 is an open-source professional review tool for the VFX, animation and CGI industries.
  It supports many image and video formats, OpenColorIO 2, native OpenTimelineIO
  timelines, a full featured Python API and OpenUSD OpenGL previews.
    
base: core22
grade: stable
      
confinement: classic     # strict, classic or devmode
      
apps:
  mrv2:
    command: bin/mrv2.sh
    environment:
      LIBGL_ALWAYS_SOFTWARE: 0
    plugs:
      - alsa
      - audio-playback
      - desktop
      - desktop-legacy
      - home
      - network
      - network-bind
      - opengl
      - pulseaudio
      - wayland
      - x11
      
parts:
  mrv2:
    plugin: dump
    source: @PACKAGE_NAME@
    build-attributes:
      - enable-patchelf
    stage-packages:
      - libasound2
      - libasound2-plugins
      - libegl1
      - libfontconfig1
      - libgl1
      - libglu1-mesa
      - libharfbuzz0b  # b at end is fine
      - libopengl0
      - libpulse0
      - libx11-6
      - libx11-xcb1
      - libxcb1
      - libxcb-render0
      - libxcb-shm0
      - libxcomposite1
      - libxcursor1
      - libxdamage1
      - libxext6
      - libxft2
      - libxfixes3
      - libxi6
      - libxinerama1
      - libxrandr2
      - libxrender1
      - libxss1
      - libxt6
      - libwayland-client0
      - libwayland-cursor0
      - libwayland-egl1

The problem seems to be that:

$ apt-file find /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_ctl_pipewire.so pipewire-alsa: /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_ctl_pipewire.so

is not staged. However, when I try to add it to the stage-packages, the package is not found.

Here’s a simple Makefile that I use to download the package and build it:


VERSION := $(shell wget -q "https://api.github.com/repos/ggarra13/mrv2/releases/latest" -O - | grep tag_name | cut -d'"' -f4 | sed 's|^v||')
INSTALL  := mrv2-v$(VERSION)-Linux-amd64/usr/local/mrv2-v$(VERSION)-Linux-64
FILENAME := mrv2-v$(VERSION)-Linux-amd64.tar.gz
URL      := https://github.com/ggarra13/mrv2/releases/download/v$(VERSION)/$(FILENAME)
ARCH     := amd64
PACKAGE  := ./$(INSTALL)

all: snap
.PHONY: all snap

snap: desktop
	sed "s#@VERSION@#$(VERSION)#g ; \
	     s#@ARCH@#$(ARCH)#g ; \
	     s#@PACKAGE_NAME@#$(PACKAGE)#" \
             snapcraft.yaml.in > snap/snapcraft.yaml
	# We will get a number of unused libraries that are loaded on demand
	# with dlopen or python's imports.
	snapcraft --debug --use-lxd

desktop: untar
	mkdir -p snap/gui
	cp -f $(INSTALL)/share/applications/mrv2.desktop snap/gui
	cp -f $(INSTALL)/share/icons/hicolor/48x48/apps/mrv2.png snap/gui
	sed -i "s#Exec=.*#Exec=mrv2# ; s#Icon=.*#Icon=mrv2.png#" snap/gui/mrv2.desktop

	# Removed incorrect line in the .tar.gz desktop file.
	sed -i "s#Categories=Graphics##" snap/gui/mrv2.desktop

download: clean
	curl -C - -L $(URL) --output $(FILENAME)

untar: download
    ifneq ($(wildcard $(INSTALL)), $(INSTALL))
	tar xfv $(FILENAME)
    endif
	# Some incorrect libraries bundled
	rm -f $(INSTALL)/lib/libndi*5*
	rm -f $(INSTALL)/lib/libtinfo*

mrv2-$(VERSION)_$(ARCH).snap: snap
	echo "Built snap"

install: mrv2-$(VERSION)_$(ARCH).snap
	sudo SNAPD_DEBUG=1 SNAPD_DEBUG_HTTP=7 snap install ./mrv2_$(VERSION)_$(ARCH).snap --dangerous --classic

uninstall:
	sudo snap remove mrv2

distclean: clean
	rm -rf mrv2-*-Linux*
	rm -f compile.log

clean:
	rm -f mrv2_$(VERSION)_$(ARCH).snap
	rm -rf snap/

Hello ! @ggarra13

Try this scenario to see. :face_with_monocle:

Add this line in your apps entry ( target → environment) like this :

apps:
    mrv2:
        environment:
            LD_LIBRARY_PATH: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio:${LD_LIBRARY_PATH:-}"

Hi, @baldeuniversel !!!

Thanks for answering. I’ve tried what you suggested without success. Here’s my LD_LIBRARY_PATH when run (my start-up script also does some customization to it):

LD_LIBRARY_PATH=/snap/mrv2/x3/lib64:/snap/mrv2/x3/lib:/usr/local/lib:/usr/lib:/lib:/usr/local/lib32/:/usr/lib32:/lib32::/opt/lib:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/:/usr/lib64:/usr/lib
ALSA lib dlmisc.c:337:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_ctl_pipewire.so (/snap/mrv2/x2/bin/../usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_ctl_pipewire.so: cannot open shared object file: No such file or directory)

The problem is not the environment, AFAICT, but the fact that there’s no libasound_module_ctl_pipewire.so anywhere to be found.

On Ubuntu 24.04.4 LTS that .so belongs to pipewire-alsa.

But on core22, I figured out that the package is:

  - pipewire-audio-client-libraries # pipewire-alsa in core24

However, adding that to stage-packages led to a new error and an actual crash on starting the application:

[E] pw.loop [loop.c:86 pw_loop_new()] 0x29568e0: can't make support.system handle: No such file or directory

@ggarra13, interesting ! :thinking:

Add pipewire itself in your stage-packages and some libraries (if missing), like this(below) and try again :

parts:
  mrv2:
    plugin: dump
    source: @PACKAGE_NAME@
    build-attributes:
      - enable-patchelf
    stage-packages:
        - pipewire
        - libpipewire-0.3-0
        - libspa-0.2-modules

  • pipewire already brings libpipewire-0.3.0 and as I mentioned, the main package missing is: pipewire-audio-client-libraries

With that, there’s no ALSA error, but my program aborts with a pulse audio error as specified above.

@ggarra13 Okay.

Perhaps, there is a permission blockage, according to this documentation audio-playback, audio-playback is not connected is connected by default .

Try this, after installing the mrv2(your snap) snap :

sudo snap connect mrv2:audio-playback
sudo snap connect mrv2:audio-record

Then, execute your program.

Read again… -playback is autoconnected by default , -record is not…

1 Like

Let’s say that I didn’t quite understand the way it was formulated :face_with_monocle: , thank you for this correction @ogra. :+1:

1 Like