Skip to content

cmd/link: failed installation due to index out of range #52736

Closed
@stevenwjy

Description

@stevenwjy

gopls version

Attempted to install the latest version, i.e.:

go install golang.org/x/tools/gopls@latest

go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/[redacted]/.cache/go-build"
GOENV="/[redacted]/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/[redacted]/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/[redacted]/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2921475380=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Attempted to install the latest version, i.e.:

go install golang.org/x/tools/gopls@latest

What did you expect to see?

Successful installation

What did you see instead?

# golang.org/x/tools/gopls
panic: runtime error: index out of range [2147483627] with length 27

goroutine 1 [running]:
cmd/link/internal/loader.(*Loader).resolve(0x439?, 0xc000f7fe00?, {0x8c0000?, 0xc0?})
	/usr/local/go/src/cmd/link/internal/loader/loader.go:667 +0x1ae
cmd/link/internal/loader.Reloc.Sym({0x7f9e1d38edc7?, 0xc000f7fe00?, 0xc0008c0000?})
	/usr/local/go/src/cmd/link/internal/loader/loader.go:59 +0x35
cmd/link/internal/loader.(*Loader).UndefinedRelocTargets(0xc0008c0000, 0x1)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:2465 +0x1a5
cmd/link/internal/ld.(*Link).loadlib(0xc000196000)
	/usr/local/go/src/cmd/link/internal/ld/lib.go:600 +0x5d7
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0x0, 0x0}, {0x67f563, ...}, ...})
	/usr/local/go/src/cmd/link/internal/ld/main.go:261 +0xe2b
main.main()
	/usr/local/go/src/cmd/link/main.go:69 +0xfe5

Editor and settings

None. Initially attempted the installation through VSCode but failed, afterward I tried to run the command directly from terminal and it gave the same error output.

Activity

added
ToolsThis label describes issues relating to any tools in the x/tools repository.
goplsIssues related to the Go language server, gopls.
on May 6, 2022
added this to the Unreleased milestone on May 6, 2022
suzmue

suzmue commented on May 6, 2022

@suzmue
Contributor

This looks like an issue with cmd/link not gopls, so I am updating the title accordingly.

changed the title [-]x/tools/gopls: failed installation due to index out of range[/-] [+]cmd/link: failed installation due to index out of range[/+] on May 6, 2022
removed
goplsIssues related to the Go language server, gopls.
ToolsThis label describes issues relating to any tools in the x/tools repository.
on May 6, 2022
cherrymui

cherrymui commented on May 6, 2022

@cherrymui
Member

What version of Go do you use? I saw GOVERSION="go1.18" but I cannot reproduce it with go1.18.

Maybe try clean your cache (go clean -cache, go clean -modcache) in case some cached file is corrupted?

added
WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.
on May 6, 2022
stevenwjy

stevenwjy commented on May 7, 2022

@stevenwjy
Author

Ah yeah, sorry it seems like some of my cached files were somehow corrupted. Managed to resolve this with go clean -cache and go clean -modcache. Thanks!

locked and limited conversation to collaborators on May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @suzmue@gopherbot@cherrymui@stevenwjy

        Issue actions

          cmd/link: failed installation due to index out of range · Issue #52736 · golang/go