[GH-ISSUE #20] Help requested: building on raspbian bullseye #15

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

Originally created by @txoof on GitHub (Feb 23, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/20

I'm rather new to GO and trying to build go-librespot on Raspbian Bullseye. I'm a little stuck with the building and hope that someone can point me in the right direction.

I've attempted to build using the default golang package (go 1.19), but I get the message:

audio/decryptor.go:31:17: undefined: bytes.Clone
note: module requires Go 1.20

Unfortunately, the debian bookworm-backports 1.21 version of Go isn't available for RaspberryPi OS.

Attempting to build from go 1.22.0-linux-armv6l obtained from go.dev aborts with the message below. After some googling, I gather this has something to do with cross compiling, but I'm a bit lost as to where to start with resolving this.

go: downloading golang.org/x/net v0.11.0
# runtime/cgo
gcc: error: unrecognized command-line option '-marm'

Any suggestions you all can offer are greatly appreciated.

For good measure:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

EDIT:

It looks like the env variable CGO_ENABLED is playing a part in this, but disabling it causes this:

$ CGO_ENABLED=0 go build -o go-librespot-daemon ./cmd/daemon                                                              (master) /
# go-librespot/output
output/output.go:8:3: undefined: output
output/output.go:45:14: undefined: newOutput
# 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
Originally created by @txoof on GitHub (Feb 23, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/20 I'm rather new to GO and trying to build go-librespot on Raspbian Bullseye. I'm a little stuck with the building and hope that someone can point me in the right direction. I've attempted to build using the default golang package (go 1.19), but I get the message: ``` audio/decryptor.go:31:17: undefined: bytes.Clone note: module requires Go 1.20 ``` Unfortunately, the debian bookworm-backports 1.21 version of Go isn't available for RaspberryPi OS. Attempting to build from go 1.22.0-linux-armv6l obtained from go.dev aborts with the message below. After some googling, I gather this has something to do with cross compiling, but I'm a bit lost as to where to start with resolving this. ``` go: downloading golang.org/x/net v0.11.0 # runtime/cgo gcc: error: unrecognized command-line option '-marm' ``` Any suggestions you all can offer are greatly appreciated. For good measure: ``` $ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" ``` ## EDIT: It looks like the env variable `CGO_ENABLED` is playing a part in this, but disabling it causes this: ``` $ CGO_ENABLED=0 go build -o go-librespot-daemon ./cmd/daemon (master) / # go-librespot/output output/output.go:8:3: undefined: output output/output.go:45:14: undefined: newOutput # 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 ```
kerem closed this issue 2026-02-28 14:24:41 +03:00
Author
Owner

@txoof commented on GitHub (Feb 23, 2024):

I've resolved this issue, but I'm not entirely sure why it works. Can anyone explain why this works?

env GOARCH=arm64 GOOS=linux CGO_ENABLED=1 go build -o go-librespot-daemon ./cmd/daemon
<!-- gh-comment-id:1961592392 --> @txoof commented on GitHub (Feb 23, 2024): I've resolved this issue, but I'm not entirely sure why it works. Can anyone explain why this works? ``` env GOARCH=arm64 GOOS=linux CGO_ENABLED=1 go build -o go-librespot-daemon ./cmd/daemon ```
Author
Owner

@devgianlu commented on GitHub (Feb 23, 2024):

Thank you for your interestin go-librespot!

The CGO_ENABLED flag set to 1 is required for building the code interfaces with the ALSA C library and therefore cannot be disabled.

With GOOS and GOARCH you are telling the compiler which operating system and architecture to target.

For additional insigth you can have a look at how the pre-made binaries are built: github.com/devgianlu/go-librespot@0774e632a8/.github/workflows/release.yml

<!-- gh-comment-id:1961795686 --> @devgianlu commented on GitHub (Feb 23, 2024): Thank you for your interestin go-librespot! The `CGO_ENABLED` flag set to `1` is required for building the code interfaces with the ALSA C library and therefore cannot be disabled. With `GOOS` and `GOARCH` you are telling the compiler which operating system and architecture to target. For additional insigth you can have a look at how the pre-made binaries are built: https://github.com/devgianlu/go-librespot/blob/0774e632a8dfa14c9ac248586d3e8f57afd8a512/.github/workflows/release.yml
Author
Owner

@txoof commented on GitHub (Feb 24, 2024):

@devgianlu Thanks for that explanation. I've got it working properly now.

<!-- gh-comment-id:1962440876 --> @txoof commented on GitHub (Feb 24, 2024): @devgianlu Thanks for that explanation. I've got it working properly now.
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#15
No description provided.