librespot-org / librespot-golang

Go port of librespot, the Open Source Spotify client library
MIT License
169 stars 39 forks source link

First run issue #33

Open KiSa04 opened 10 months ago

KiSa04 commented 10 months ago

I'm currently trying to run librespot-golang for the first time, but I'm getting these errors after go run main.go

# github.com/xlab/vorbis-go/decoder ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:28:19: undefined: vorbis.OggSyncState ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:31:21: undefined: vorbis.OggStreamState ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:35:14: undefined: vorbis.OggPage ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:39:16: undefined: vorbis.OggPacket ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:42:14: undefined: vorbis.Info ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:45:17: undefined: vorbis.Comment ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:49:18: undefined: vorbis.DspState ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\decoder.go:54:15: undefined: vorbis.Block ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\util.go:11:26: undefined: vorbis.Info ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\util.go:11:43: undefined: vorbis.Comment ..\..\..\go\pkg\mod\github.com\xlab\vorbis-go@v0.0.0-20190125051917-087364aef51d\decoder\util.go:11:43: too many errors

Xantios commented 4 months ago

I had the same issue, you can fix it by enabled CGO Here is a dockerfile i use

FROM golang:1.22-alpine3.19

WORKDIR /app

RUN apk add vim git bash
RUN apk add pkgconfig portaudio-dev # Needed to get PortAudio-go
RUN apk add gcc g++ # Needed for CGO
RUN apk add libvorbis libvorbis-dev libogg libogg-dev # Needed OGG Lib

ENV CGO_ENABLED = 1

RUN go install github.com/cosmtrek/air@latest

ENTRYPOINT ["air","-c",".air.toml"]