What version of Go are you using (go version)?
$ go version
go version go1.21.0 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ /usr/lib/go/bin/go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/g4s8/.cache/go-build'
GOENV='/home/g4s8/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/g4s8/go/pkg/mod'
GOOS='linux'
GOPATH='/home/g4s8/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4273986275=/tmp/go-build -gno-record-gcc-switches'
What did you do?
I'm trying to build go 1.21.0 from sources for Void Linux go package: https://github.com/void-linux/void-packages
The steps to build it (inside go repo directory):
unset GCC CC CXX LD CFLAGS
unset CGO_CXXFLAGS CGO_ENABLED
export GOROOT_FINAL=/usr/lib/go
export GOROOT=$PWD
export GOARCH=amd64
cd src
bash make.bash -v
sudo rm -f /usr/bin/go
sudo rm -fr /usr/lib/go/
sudo cp ../bin/* -t /usr/bin
sudo cp -r .. /usr/lib/go
What did you expect to see?
When running /usr/bin/go version (or any other go command, like go build, etc) to see
go version go1.21.0 linux/amd64
What did you see instead?
When running go command or /usr/bin/go:
$ go version
go: cannot find GOROOT directory: 'go' binary is trimmed and GOROOT is not set
$ go build
go: cannot find GOROOT directory: 'go' binary is trimmed and GOROOT is not set
If I run /usr/lib/go/bin/go, then all commands works fine:
$ /usr/lib/go/bin/go version
go version go1.21.0 linux/amd64
If I run exactly the same build commands for go version 1.20.7, it's working fine:
$ go version
go version go1.20.7 linux/amd64
or
$ /usr/bin/go version
go version go1.20.7 linux/amd64
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
I'm trying to build go 1.21.0 from sources for Void Linux
gopackage: https://github.com/void-linux/void-packagesThe steps to build it (inside
gorepo directory):What did you expect to see?
When running
/usr/bin/go version(or any othergocommand, likego build, etc) to seeWhat did you see instead?
When running
gocommand or/usr/bin/go:If I run
/usr/lib/go/bin/go, then all commands works fine:If I run exactly the same build commands for go version 1.20.7, it's working fine:
or