Description
Go version
go version go1.21.5 darwin/arm64
What operating system and processor architecture are you using (go env
)?
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/burakkiran/Library/Caches/go-build'
GOENV='/Users/burakkiran/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/burakkiran/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/burakkiran/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/burakkiran/project/providers/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/var/folders/66/m0ltsv192tl3tbf3cq4t2lgh0000gn/T/go-build556361885=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
Hi, I have just set up my M1 mac and am having trouble running a go project that I had originally built using an Intel based mac
-
I downloaded the latest version of Go and Pulled down the repo
-
Project Set up and Installed Dependencies
go get .
- I ran both commands:
go run .
go build
More info
This project leverages Sqlite so I understand where the cgo dependency is needed. Am I missing a step in my go installation to link to the correct C compiler?
Dependencies that the project is pulling in from go.mod
:
require (
github.com/mattn/go-sqlite3 v1.14.17
github.com/gorilla/sessions v1.1.1
github.com/markbates/goth v1.78.0
golang.org/x/crypto v0.14.0
)
What did you expect to see?
Program executes, in this instance a web server.
What did you see instead?
Stack trace
# runtime/cgo
cgo: exec clang: fork/exec /usr/local/opt/llvm/bin/clang: bad CPU type in executable# runtime/cgo
Related Issues:
Somewhat similar, different stack trace:
#45772
Same error building docker compose which is a go based project:
docker/for-mac#6232
Solution seemed to be:
softwareupdate --install-rosetta
But is x86 -> arm64 translation needed for such a simple project/build?