Hello, new here.
Today i build my first snap app. It’s a simple bash script that plays url via mpv.
name: shelldio
base: core22
version: '4.2.0'
summary: A description of shelldio
description: |
A brief description of shelldio and its functionality.
grade: stable
confinement: strict
parts:
shelldio:
### Dump Plugin used for dump contents from the specified source.
plugin: dump
source: https://github.com/CerebruxCode/shelldio/archive/refs/tags/v4.2.0.tar.gz
stage-packages:
- psmisc
- mpv
- curl
- libpulse0
- libpulse-dev
shelldio-script:
### Nil Plugin used for parts with no source to import
plugin: nil
source: .
override-build: |
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp $CRAFT_PART_SRC/parts/shelldio/src/shelldio.sh $SNAPCRAFT_PART_INSTALL/bin/shelldio.sh
chmod +x $SNAPCRAFT_PART_INSTALL/bin/shelldio.sh
apps:
shelldio:
command: bin/shelldio.sh
plugs:
- audio-playback # Add audio-playback plug here
- network
Whatever i do, i cannot have sound in the application. Need help.
Hi ! @JohnGavr .
Did you connect the plug you created audio-playback
?
That’s not necessary :
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
Thanks for your reply.
Yes audio-playback is connected and as i read that plug is auto connected.
@JohnGavr ! You’re right. The audio-playback
is enabled by default.
@JohnGavr , when you do this (from the terminal), what do you obtain ?
pulseaudio --check
Pulseaudio is not installed in Ubuntu 23.10.
You can install pulseaudio
via the command :
sudo apt install pulseaudio
From Ubuntu 22.10 (if i am correct for the version) ubuntu uses pipewire for sound server.
inxi -A ~
Audio:
Device-1: Intel 7 Series/C216 Family High Definition Audio
driver: snd_hda_intel
API: ALSA v: k6.5.0-27-generic status: kernel-api
Server-1: PipeWire v: 0.3.79 status: active
Why i need to install pulseaudio??
Okay @JohnGavr .
if you use pipewire
, pulseaudio
can be ignored.
What"s the output of the execution of this command :
systemctl --user status pipewire
The pipewire service.
● pipewire.service - PipeWire Multimedia Service
Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
Active: active (running) since Fri 2024-04-19 15:49:47 EEST; 1min 0s ago
TriggeredBy: ● pipewire.socket
Main PID: 2749 (pipewire)
Tasks: 3 (limit: 6863)
Memory: 7.9M
CPU: 150ms
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
└─2749 /usr/bin/pipewire
Apr 19 15:49:47 atlas systemd[2707]: Started pipewire.service - PipeWire Multimedia Service.
@JohnGavr ! Well , I see. The service is active.
Maybe you must connect alsa
too .
I think that i found something. My new snap.yaml file is that
name: shelldio
base: core22
version: '4.2.0'
summary: A description of shelldio
description: |
A brief description of shelldio and its functionality.
grade: devel
confinement: devmode
apps:
shelldio:
command: usr/bin/shelldio
plugs:
- audio-playback # Add audio-playback plug here
- network
- pulseaudio
- home
parts:
shelldio:
### Dump Plugin used for dump contents from the specified source.
plugin: dump
source: https://github.com/CerebruxCode/shelldio/archive/refs/tags/v4.2.0.tar.gz
#override-build: |
# mkdir -p $SNAPCRAFT_PART_INSTALL/bin
# cp /root/parts/shelldio/src/shelldio.sh $SNAPCRAFT_PART_INSTALL/bin/shelldio.sh
# chmod +x $SNAPCRAFT_PART_INSTALL/bin/shelldio.sh
organize:
shelldio.sh: usr/bin/shelldio
stage-packages:
- mpv
- curl
- grep
- libglu1-mesa
- freeglut3
- libcaca0
- psmisc
- libpulse0
I try to run snap in --shell
snap run --shell shelldio
and try the mpv command which the bash script runs i take that error
error while loading shared libraries: libpulsecommon-15.99.so: cannot open shared object file: No such file or directory
Okay !
You must add the lib libpulsecommon-15.99.so
@JohnGavr ! Here the name of the lib in question.
libpulse-dev
ogra
April 19, 2024, 2:04pm
17
This is wrong, you do not want the headers but the runtime library … (i.e. not the -dev package)
Also note that libpulse does not install in the standard library search path, you need an environment:
entry to adjust LD_LIBRARY_PATH to make it found…
ogra:
This is wrong, you do not want the headers but the runtime library … (i.e. not the -dev package)
Also note that libpulse does not install in the standard library search path, you need an environment:
entry to adjust LD_LIBRARY_PATH to make it found…
How will the *.yaml
file look like in this sense.
Thanks @ogra .
@JohnGavr , you can add this :
apps:
shelldio:
environment:
LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio:$LD_LIBRARY_PATH