faiface / beep

A little package that brings sound to any Go application. Suitable for playback and audio-processing.
MIT License
2.08k stars 151 forks source link

Unable to build in linux - undefined: driver in oto@v0.3.1 #74

Open stjohnjohnson opened 4 years ago

stjohnjohnson commented 4 years ago

I've been using your library pretty successfully on OSX, but when I tried to cross compile for Linux I ran into the following error on build:

$ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
# github.com/hajimehoshi/oto
/go/pkg/mod/github.com/hajimehoshi/oto@v0.3.1/context.go:120:18: undefined: driver

I tried to make the most minimal example and found it with the 1-hello-world/a tutorial. Here is a reproduction gist that will run it both locally and in the golang:1.13 container.

$ make
Running locally
GOOS=linux GOARCH=amd64 go build
# github.com/hajimehoshi/oto
../../go/pkg/mod/github.com/hajimehoshi/oto@v0.3.1/context.go:120:18: undefined: driver
make[1]: *** [local] Error 2
make: [default] Error 2 (ignored)
Running in Docker
docker run --rm -v`pwd`:/src -w /src -e CGO_ENABLED=0 golang:1.13 go build
go: downloading github.com/faiface/beep v1.0.2
go: extracting github.com/faiface/beep v1.0.2
go: downloading github.com/hajimehoshi/oto v0.3.1
go: downloading github.com/pkg/errors v0.8.1
go: downloading github.com/hajimehoshi/go-mp3 v0.1.1
go: extracting github.com/pkg/errors v0.8.1
go: extracting github.com/hajimehoshi/oto v0.3.1
go: extracting github.com/hajimehoshi/go-mp3 v0.1.1
go: finding github.com/faiface/beep v1.0.2
go: finding github.com/hajimehoshi/oto v0.3.1
go: finding github.com/hajimehoshi/go-mp3 v0.1.1
go: finding github.com/pkg/errors v0.8.1
# github.com/hajimehoshi/oto
/go/pkg/mod/github.com/hajimehoshi/oto@v0.3.1/context.go:120:18: undefined: driver
make[1]: *** [docker] Error 2
make: [default] Error 2 (ignored)
dericmiller commented 4 years ago

Can you tell me which version of OSX you're running? I'm finding the OpenAL deprecation in 10.15 breaking oto (which breaks beep).

stjohnjohnson commented 4 years ago

Sorry for the delay, OSX Catalina - 10.15.2 (19C57)

samuelebistoletti commented 4 years ago

Same issue here with Ubuntu 18.04

It happens only inside "make".

GOARCH=amd64 go build -ldflags='-s -w -X main.Version=2.0.0 -X main.BuildTime=2020-03-04T13:43:16+0100' -o builds/bin/2.0.0/ex .; else GOARCH=amd64 GOARM=7 go build -ldflags=-s -w -X main.Version=2.0.0 -X main.BuildTime=2020-03-04T13:43:16+0100 -o builds/bin/2.0.0/cyclops_amd64v7 .

This works outside make, but if I try to build it from a makefile I get: github.com/hajimehoshi/oto ../../../../pkg/mod/github.com/hajimehoshi/oto@v0.3.1/context.go:120:18: undefined: driver