Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: plugin was built with a different version of package internal/goarch #61150

Closed
pohly opened this issue Jul 3, 2023 · 7 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@pohly
Copy link

pohly commented Jul 3, 2023

What version of Go are you using (go version)?

$ go version
go version go1.21rc2 linux/amd64

Does this issue reproduce with the latest release?

Yes. It still worked with Go 1.20.4.

What operating system and processor architecture are you using (go env)?

Debian GNU/Linux 10 (buster), amd64

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/pohly/.cache/go-build'
GOENV='/home/pohly/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/nvme/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/nvme/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nvme/gopath/go-1.21rc2'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nvme/gopath/go-1.21rc2/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21rc2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/nvme/gopath/src/github.com/pohly/go-plugin/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-build2784042289=/tmp/go-build -gno-record-gcc-switches'

What did you do?

In Kubernetes, we build golangci-lint and a plugin for it inside the same Go environment. That worked with Go 1.20. When trying to upgrade to 1.21rc2, plugin loading fails with Unable to load custom analyzer logcheck:../_output/local/bin/logcheck.so, plugin.Open(\"/nvme/gopath/src/k8s.io/kubernetes/_output/local/bin/logcheck\"): plugin was built with a different version of package encoding".

This only fails on my desktop. It fails differently (for other reasons) in the Kubernetes CI.

Here is a simple reproducer: https://github.com/pohly/go-plugin/tree/master

go-plugin$ go version
go version go1.21rc2 linux/amd64
go-plugin$ make  clean all
rm -f main plugin.so
go build -o main .
go build -buildmode=plugin -o plugin.so ./plugin
go-plugin$ ./main 
loading plugin: plugin.Open("./plugin"): plugin was built with a different version of package internal/goarch

What did you expect to see?

Plugin should load.

What did you see instead?

plugin was built with a different version of package (which specific package depends on the plugin)

@MadhavJivrajani
Copy link

Hmm
I can't seem to reproduce this on darwin/amd64

❯ go version
go version go1.21rc2 darwin/amd64
❯ make clean all
rm -f main plugin.so
go build -o main .
go build -buildmode=plugin -o plugin.so ./plugin
❯ rm -f main plugin.so
❯ go build -o main .
❯ go build -buildmode=plugin -o plugin.so ./plugin
❯ ./main
❯ echo $?
0

@pohly
Copy link
Author

pohly commented Jul 3, 2023

It's also okay on my Debian 11 (bullseye) installation.

@seankhliao seankhliao changed the title affected/package: plugin: bogus package version mismatch starting with Go 1.21 plugin: plugin was built with a different version of package internal/goarch Jul 3, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 3, 2023
@seankhliao
Copy link
Member

it also works in a debian buster container

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 3, 2023
@pohly
Copy link
Author

pohly commented Jul 3, 2023

What information can I provide to narrow down why it fails now? The exact same environment worked before I switched to Go 1.21rc2.

@pohly
Copy link
Author

pohly commented Jul 3, 2023

I can go back and forth between the two Go installations and one works while the other doesn't.

@seankhliao
Copy link
Member

some way for someone else to actually reproduce it.
go version -m <file> on both?
build logs with -a -x for both?
zip up the files and upload them?

@pohly
Copy link
Author

pohly commented Jul 3, 2023

It seems to depend on the content of my $HOME. A test account on the desktop works, and so does my normal user when (temporarily) replacing $HOME with an empty directory. Let's see...

It turned out to be the content of $HOME/.cache/go-build. After removing that, it started to work.

Now that I have wiped it, I can no longer reproduce the issue. Feel free to close the issue. I still think that this shouldn't have happened, but I understand that it's close to impossible to root cause now.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants