[GH-ISSUE #29] Raspberry Pi Zero W (DietPi) support? #24

Closed
opened 2026-02-28 14:24:45 +03:00 by kerem · 3 comments
Owner

Originally created by @moranbw on GitHub (Apr 4, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/29

Does this support Raspberry Pi Zero W? It is armv6l. I am running DietPi v9.2. I tried building, but got the following errors:

user@pizero:/mnt/dietpi_userdata/go-librespot$ go build -o go-librespot-daemon ./cmd/daemon
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
go: downloading google.golang.org/protobuf v1.30.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading nhooyr.io/websocket v1.8.7
go: downloading golang.org/x/sys v0.10.0
go: downloading github.com/cenkalti/backoff/v4 v4.2.1
go: downloading github.com/cenkalti/backoff v2.2.1+incompatible
go: downloading github.com/devgianlu/shannon v0.0.0-20230613115856-82ec90b7fa7e
go: downloading golang.org/x/crypto v0.10.0
go: downloading github.com/grandcat/zeroconf v1.0.0
go: downloading github.com/klauspost/compress v1.10.3
go: downloading github.com/xlab/vorbis-go v0.0.0-20210911202351-b5b85f1ec645
go: downloading github.com/miekg/dns v1.1.54
go: downloading golang.org/x/net v0.11.0
# go-librespot/audio
audio/metadata.go:51:23: undefined: vorbis.OggSyncState
audio/metadata.go:52:9: undefined: vorbis.OggSyncInit
audio/metadata.go:55:10: undefined: vorbis.OggSyncClear
audio/metadata.go:62:16: undefined: vorbis.OggSyncBuffer
audio/metadata.go:64:9: undefined: vorbis.OggSyncWrote
audio/metadata.go:69:18: undefined: vorbis.OggPage
audio/metadata.go:70:19: undefined: vorbis.OggSyncPageout
audio/metadata.go:74:25: undefined: vorbis.OggStreamState
audio/metadata.go:75:9: undefined: vorbis.OggStreamInit
audio/metadata.go:75:44: undefined: vorbis.OggPageSerialno
audio/metadata.go:75:44: too many errors
# go-librespot/output
output/output.go:8:3: undefined: output
output/output.go:45:14: undefined: newOutput

I tried the prebuild binary: go-librespot_linux_armv6_rpi.tar.gz but got the following:

INFO[0000] generated new device id: a4c8bdf7561af701c201895aefe7ae4216a3bf24
INFO[0015] accepted zeroconf user xxx from iPhone
WARN[0016] failed handling dealer request                error="failed loading current track (transfer): failed creating stream for spotify:track:5F6ZjgYSsgFyqV4htHdWFD: failed seeking stream: failed reading chunk: EOF"
WARN[0027] failed handling dealer request                error="failed loading current track (load context): failed creating stream for spotify:track:4ewRM5SP4YhmlfKhi5uSjS: ALSA error at snd_pcm_hw_params_set_format: Invalid argument"
Originally created by @moranbw on GitHub (Apr 4, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/29 Does this support Raspberry Pi Zero W? It is `armv6l`. I am running DietPi `v9.2`. I tried building, but got the following errors: ``` user@pizero:/mnt/dietpi_userdata/go-librespot$ go build -o go-librespot-daemon ./cmd/daemon go: downloading github.com/sirupsen/logrus v1.9.3 go: downloading golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 go: downloading google.golang.org/protobuf v1.30.0 go: downloading gopkg.in/yaml.v3 v3.0.1 go: downloading nhooyr.io/websocket v1.8.7 go: downloading golang.org/x/sys v0.10.0 go: downloading github.com/cenkalti/backoff/v4 v4.2.1 go: downloading github.com/cenkalti/backoff v2.2.1+incompatible go: downloading github.com/devgianlu/shannon v0.0.0-20230613115856-82ec90b7fa7e go: downloading golang.org/x/crypto v0.10.0 go: downloading github.com/grandcat/zeroconf v1.0.0 go: downloading github.com/klauspost/compress v1.10.3 go: downloading github.com/xlab/vorbis-go v0.0.0-20210911202351-b5b85f1ec645 go: downloading github.com/miekg/dns v1.1.54 go: downloading golang.org/x/net v0.11.0 # go-librespot/audio audio/metadata.go:51:23: undefined: vorbis.OggSyncState audio/metadata.go:52:9: undefined: vorbis.OggSyncInit audio/metadata.go:55:10: undefined: vorbis.OggSyncClear audio/metadata.go:62:16: undefined: vorbis.OggSyncBuffer audio/metadata.go:64:9: undefined: vorbis.OggSyncWrote audio/metadata.go:69:18: undefined: vorbis.OggPage audio/metadata.go:70:19: undefined: vorbis.OggSyncPageout audio/metadata.go:74:25: undefined: vorbis.OggStreamState audio/metadata.go:75:9: undefined: vorbis.OggStreamInit audio/metadata.go:75:44: undefined: vorbis.OggPageSerialno audio/metadata.go:75:44: too many errors # go-librespot/output output/output.go:8:3: undefined: output output/output.go:45:14: undefined: newOutput ``` I tried the prebuild binary: `go-librespot_linux_armv6_rpi.tar.gz` but got the following: ``` INFO[0000] generated new device id: a4c8bdf7561af701c201895aefe7ae4216a3bf24 INFO[0015] accepted zeroconf user xxx from iPhone WARN[0016] failed handling dealer request error="failed loading current track (transfer): failed creating stream for spotify:track:5F6ZjgYSsgFyqV4htHdWFD: failed seeking stream: failed reading chunk: EOF" WARN[0027] failed handling dealer request error="failed loading current track (load context): failed creating stream for spotify:track:4ewRM5SP4YhmlfKhi5uSjS: ALSA error at snd_pcm_hw_params_set_format: Invalid argument" ```
kerem closed this issue 2026-02-28 14:24:45 +03:00
Author
Owner

@devgianlu commented on GitHub (Apr 4, 2024):

Building from source for the Raspberry Pi Zero W is quite complicated because of missing support for Thumb instructions, you can have a look at how the binary is built with a custom toolchain here.

Regarding the errors you see, I think that the ALSA issue might be related to limited software support and/or network problems. I have go-librespot running on a Raspberry Pi Zero W v1.1 with the Volumio OS.

<!-- gh-comment-id:2037700164 --> @devgianlu commented on GitHub (Apr 4, 2024): Building from source for the Raspberry Pi Zero W is quite complicated because of missing support for Thumb instructions, you can have a look at how the binary is built with a custom toolchain [here](https://github.com/devgianlu/go-librespot/blob/master/.github/workflows/release.yml). Regarding the errors you see, I think that the ALSA issue might be related to limited software support and/or network problems. I have go-librespot running on a Raspberry Pi Zero W v1.1 with the [Volumio OS](https://volumio.com/get-started/).
Author
Owner

@moranbw commented on GitHub (Apr 4, 2024):

Thanks for the response, @devgianlu.

I actually was able to figure out what was going on. I was perusing the spotifyd config options and saw this, which correlated with my snd_pcm_hw_params_set_format error.

# The PCM sample format to use. Possible values 
# are F32, S32, S24, S24_3, S16. 
# Change this value if you encounter errors like
# "Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_format' failed with error 'EINVAL: Invalid argument'"
audio_format = "S16"

It seems like there is not a similar config option in go-librespot. So I figured out a way to force the PCM format to S16_LE by adding this to /etc/asound.conf:

pcm.formatS16 {
        type plug
        slave {
                pcm "hw:0,0"
                format S16_LE
        }
}

Note

Users with multiple cards/devices may need to adjust the pcm "hw:0,0" line.

Then updated my go-librespot config.yml:

audio_device: formatS16

And we have music! Perhaps Volumio OS is doing some of this by default? It is just based on Raspbian (like DietPi), so nothing too special should be going on.

<!-- gh-comment-id:2038153676 --> @moranbw commented on GitHub (Apr 4, 2024): Thanks for the response, @devgianlu. I actually was able to figure out what was going on. I was perusing the `spotifyd` config options and saw this, which correlated with my `snd_pcm_hw_params_set_format` error. ``` # The PCM sample format to use. Possible values # are F32, S32, S24, S24_3, S16. # Change this value if you encounter errors like # "Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_format' failed with error 'EINVAL: Invalid argument'" audio_format = "S16" ``` It seems like there is not a similar config option in `go-librespot`. So I figured out a way to force the PCM format to `S16_LE` by adding this to `/etc/asound.conf`: ``` pcm.formatS16 { type plug slave { pcm "hw:0,0" format S16_LE } } ``` > [!NOTE] > Users with multiple cards/devices may need to adjust the `pcm "hw:0,0"` line. Then updated my `go-librespot` `config.yml`: ``` audio_device: formatS16 ``` And we have music! Perhaps Volumio OS is doing some of this by default? It is just based on Raspbian (like DietPi), so nothing **too** special should be going on.
Author
Owner

@devgianlu commented on GitHub (Apr 8, 2024):

I am glad you figured it out! I am not sure whether an option to tweak the output format from go-librespot is really necessary considering that ALSA can do the heavy lifting.

<!-- gh-comment-id:2043505607 --> @devgianlu commented on GitHub (Apr 8, 2024): I am glad you figured it out! I am not sure whether an option to tweak the output format from `go-librespot` is really necessary considering that ALSA can do the heavy lifting.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#24
No description provided.