I’m trying to compile a program written in Go. With Go standard compiler everything work and the program is generated normally.
But when I switch to gccgo compiler, errors like this appears:
$ go build -x -compiler gccgo
WORK=/tmp/go-build582779103
/home/user/go/pkg/mod/golang.org/x/[email protected]/curve25519/curve25519_go120.go:9:8: package crypto/ecdh is not in std (/usr/lib/go-1.22/src/crypto/ecdh)
Strangely, the directory exists and has the needed .go files:
$ ls /usr/lib/go-1.22/src/crypto/ecdh
ecdh.go ecdh_test.go nist.go x25519.go
This problem happens with more complex Go projects, with simple ones (for example, few dependencies) I can compile normally with gccgo.
My Go variables:
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/me/.cache/go-build'
GOENV='/home/me/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/me/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/me/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go-1.22'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go-1.22/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/shm/glider/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4284307836=/tmp/go-build -gno-record-gcc-switches'
My gccgo version is 13.3.0
PS.: The program I’m trying to compile with help of gcc is Glider.
przemyslawo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.