Closed JOJO0527 closed 2 years ago
Build command: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o main.go
ERR MSG:
~/go/src/github.com/klauspost/compress/flate/crc32_amd64.go:41:22: cpuid.CPU.SSE42 undefined (type cpuid.CPUInfo has no field or method SSE42)
$go env GO111MODULE="auto" GOARCH="arm64" GOBIN="~/go/bin" GOCACHE="~/Library/Caches/go-build" GOENV="~/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="~/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="~/go" GOPRIVATE="" GOPROXY="https://goproxy.cn" GOROOT="/opt/homebrew/Cellar/go/1.17.6/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/homebrew/Cellar/go/1.17.6/libexec/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.17.6" 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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8j/hl0nvryx4bx3_2cpqm2ljr3w0000gn/T/go-build944530538=/tmp/go-build -gno-record-gcc-switches -fno-common"
go/src/github.com/klauspost/compress/flate/crc32_amd64.go This is ancient, upgrade it.
go/src/github.com/klauspost/compress/flate/crc32_amd64.go
You can also pin the last v1 release
Build command: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o main.go
ERR MSG:
github.com/klauspost/compress/flate
~/go/src/github.com/klauspost/compress/flate/crc32_amd64.go:41:22: cpuid.CPU.SSE42 undefined (type cpuid.CPUInfo has no field or method SSE42)
$go env
GO111MODULE="auto" GOARCH="arm64" GOBIN="~/go/bin" GOCACHE="~/Library/Caches/go-build" GOENV="~/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="~/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="~/go" GOPRIVATE="" GOPROXY="https://goproxy.cn" GOROOT="/opt/homebrew/Cellar/go/1.17.6/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/homebrew/Cellar/go/1.17.6/libexec/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.17.6" 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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8j/hl0nvryx4bx3_2cpqm2ljr3w0000gn/T/go-build944530538=/tmp/go-build -gno-record-gcc-switches -fno-common"