Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined: newDriver compile linux from mac #125

Open
ramacatur opened this issue Jun 23, 2021 · 7 comments
Open

undefined: newDriver compile linux from mac #125

ramacatur opened this issue Jun 23, 2021 · 7 comments

Comments

@ramacatur
Copy link

Hey, I try compile my application to linux from mac but I got error like this:

env GOOS=linux GOARCH=amd64 go build -v
github.com/hajimehoshi/oto
# github.com/hajimehoshi/oto
../github.com/hajimehoshi/oto/context.go:69:12: undefined: newDriver

this is my go env

GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ramacatur/Library/Caches/go-build"
GOENV="/Users/ramacatur/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Volumes/Data/code/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Volumes/Data/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/go-build3898342957=/tmp/go-build -gno-record-gcc-switches -fno-common"

thanks for the solution

@cebarks
Copy link
Collaborator

cebarks commented Jun 23, 2021

Does it compile normally when just building for macos?

@ramacatur
Copy link
Author

Does it compile normally when just building for macos?

Yes, it is normally when building for macos.

@cebarks
Copy link
Collaborator

cebarks commented Jun 24, 2021

Do you have your go.mod setup correctly? maybe try a go mod tidy to make sure all your imports are in your go.mod.

@ramacatur
Copy link
Author

I don't use go.mod in my code. do i have to use linux to compile?

@cebarks
Copy link
Collaborator

cebarks commented Jun 24, 2021

Ah that's the problem then. you must be missing the dependency somehow. I'd recommend looking into using go modules to manage your dependencies. You might be able to fix your build with go get -u https://github.com/faiface/beep@latest but I'm not 100%.

@wxxhub
Copy link

wxxhub commented May 31, 2023

图片
I had the same problem,setting Environment CGO_ENABLED=1 in the IDE solves the problem.

@wxxhub
Copy link

wxxhub commented May 31, 2023

图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants