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

Cannot build on x86_64: not enough arguments in call to watch.NewStreamWatcher #185

Closed
YiannisGkoufas opened this issue Oct 3, 2019 · 8 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@YiannisGkoufas
Copy link

Hi everyone,

I am running into a bit of a weird issue.
I have one ppc64le machine in which external-attached builds without a problem:

$ git clone https://github.com/kubernetes-csi/external-attacher.git
$ cd external-attacher
$ make (there is an error reported trying to build for windows, but the linux build works)
$ ls bin/
csi-attacher
$ go env
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_ppc64le"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/root/external-attacher/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build135377313=/tmp/go-build -gno-record-gcc-switches"

The client-go library is:

$ ls $GOPATH/pkg/mod/k8s.io/ | grep client
client-go@v0.0.0-20190612125919-5c45477a8ae7

However the exact same make command in a x86_64 machine produces the following:

$ make
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=v2.0.0-0-g27b83ca9 -extldflags "-static"' -o ./bin/csi-attacher ./cmd/csi-attacher
go: creating new go.mod: module github.com/kubernetes-csi/external-attacher
go: copying requirements from Gopkg.lock
# k8s.io/client-go/rest
../go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/rest/request.go:598:31: not enough arguments in call to watch.NewStreamWatcher
	have (*versioned.Decoder)
	want (watch.Decoder, watch.Reporter)
make: *** [build-csi-attacher] Error 2
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/johngouf/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/johngouf/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/johngouf/external-attacher/go.mod"
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-build193746378=/tmp/go-build -gno-record-gcc-switches"

The client-go library is:

$ ls $GOPATH/pkg/mod/k8s.io/ | grep client
client-go@v11.0.0+incompatible

Any idea what I am doing wrong? Is it a bug?

Thanks!

@pohly
Copy link
Contributor

pohly commented Oct 4, 2019

It looks like you are building with Go 1.13, right? Go modules were enabled by default in that version. Our repos don't have a go.mod file and it looks like go build randomly picks dependencies.

We ship a working set of dependencies in vendor, but that gets ignored by go build when using modules.

Both of this should work:

  • GO111MODULE=off make build
  • GOFLAGS=-mod=vendor make build

Can you test and report back?

I started to convert repos over to go mod. Probably should accelerate that...

@YiannisGkoufas
Copy link
Author

Hi @pohly thanks for getting back to me!
Apologies I forgot to add the go version ( I thought there would be somewhere reported in go env )
It's actually 1.12.10.
I tested the commands and both have the exact same effect on the different architectures.
The first one:

# GO111MODULE=off make build
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=v2.0.0-0-g27b83ca -extldflags "-static"' -o ./bin/csi-attacher ./cmd/csi-attacher
cmd/csi-attacher/main.go:33:2: cannot find package "github.com/container-storage-interface/spec/lib/go/csi" in any of:
	/usr/local/go/src/github.com/container-storage-interface/spec/lib/go/csi (from $GOROOT)
	/root/go/src/github.com/container-storage-interface/spec/lib/go/csi (from $GOPATH)
cmd/csi-attacher/main.go:34:2: cannot find package "github.com/kubernetes-csi/csi-lib-utils/connection" in any of:
	/usr/local/go/src/github.com/kubernetes-csi/csi-lib-utils/connection (from $GOROOT)
	/root/go/src/github.com/kubernetes-csi/csi-lib-utils/connection (from $GOPATH)
cmd/csi-attacher/main.go:35:2: cannot find package "github.com/kubernetes-csi/csi-lib-utils/leaderelection" in any of:
	/usr/local/go/src/github.com/kubernetes-csi/csi-lib-utils/leaderelection (from $GOROOT)
	/root/go/src/github.com/kubernetes-csi/csi-lib-utils/leaderelection (from $GOPATH)
cmd/csi-attacher/main.go:36:2: cannot find package "github.com/kubernetes-csi/csi-lib-utils/rpc" in any of:
	/usr/local/go/src/github.com/kubernetes-csi/csi-lib-utils/rpc (from $GOROOT)
	/root/go/src/github.com/kubernetes-csi/csi-lib-utils/rpc (from $GOPATH)
cmd/csi-attacher/main.go:37:2: cannot find package "github.com/kubernetes-csi/external-attacher/pkg/attacher" in any of:
	/usr/local/go/src/github.com/kubernetes-csi/external-attacher/pkg/attacher (from $GOROOT)
	/root/go/src/github.com/kubernetes-csi/external-attacher/pkg/attacher (from $GOPATH)
cmd/csi-attacher/main.go:38:2: cannot find package "github.com/kubernetes-csi/external-attacher/pkg/controller" in any of:
	/usr/local/go/src/github.com/kubernetes-csi/external-attacher/pkg/controller (from $GOROOT)
	/root/go/src/github.com/kubernetes-csi/external-attacher/pkg/controller (from $GOPATH)
cmd/csi-attacher/main.go:39:2: cannot find package "google.golang.org/grpc" in any of:
	/usr/local/go/src/google.golang.org/grpc (from $GOROOT)
	/root/go/src/google.golang.org/grpc (from $GOPATH)
cmd/csi-attacher/main.go:26:2: cannot find package "k8s.io/client-go/informers" in any of:
	/usr/local/go/src/k8s.io/client-go/informers (from $GOROOT)
	/root/go/src/k8s.io/client-go/informers (from $GOPATH)
cmd/csi-attacher/main.go:27:2: cannot find package "k8s.io/client-go/kubernetes" in any of:
	/usr/local/go/src/k8s.io/client-go/kubernetes (from $GOROOT)
	/root/go/src/k8s.io/client-go/kubernetes (from $GOPATH)
cmd/csi-attacher/main.go:28:2: cannot find package "k8s.io/client-go/rest" in any of:
	/usr/local/go/src/k8s.io/client-go/rest (from $GOROOT)
	/root/go/src/k8s.io/client-go/rest (from $GOPATH)
cmd/csi-attacher/main.go:29:2: cannot find package "k8s.io/client-go/tools/clientcmd" in any of:
	/usr/local/go/src/k8s.io/client-go/tools/clientcmd (from $GOROOT)
	/root/go/src/k8s.io/client-go/tools/clientcmd (from $GOPATH)
cmd/csi-attacher/main.go:30:2: cannot find package "k8s.io/client-go/util/workqueue" in any of:
	/usr/local/go/src/k8s.io/client-go/util/workqueue (from $GOROOT)
	/root/go/src/k8s.io/client-go/util/workqueue (from $GOPATH)
cmd/csi-attacher/main.go:31:2: cannot find package "k8s.io/klog" in any of:
	/usr/local/go/src/k8s.io/klog (from $GOROOT)
	/root/go/src/k8s.io/klog (from $GOPATH)
make: *** [build-csi-attacher] Error 1

And the second one (which is working):

# GOFLAGS=-mod=vendor make build
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=v2.0.0-0-g27b83ca -extldflags "-static"' -o ./bin/csi-attacher ./cmd/csi-attacher
go: creating new go.mod: module github.com/kubernetes-csi/external-attacher
go: copying requirements from Gopkg.lock
go: converting Gopkg.lock: stat gopkg.in/yaml.v2@v2.2.2: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat golang.org/x/time@9d24e82272b4f38b78bc8cff74fa936d31ccd8ef: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/apimachinery@d7deff9243b165ee192f5551710ea4285dcfd615: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat golang.org/x/sys@81d4e9dc473e5e8c933f2aaeba2a3d81efb9aed2: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/json-iterator/go@v1.1.6: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/googleapis/gnostic@v0.2.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat golang.org/x/crypto@8e1b8d32e692162a446e97250c5d34f5a52efed6: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat google.golang.org/grpc@v1.19.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/google/gofuzz@24818f796faf91cd76ec7bddd72458fbced7a6c1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/cloud-provider@3b2502dc4098d6937c5edeb08d8ec6d774bc2d28: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/container-storage-interface/spec@v1.1.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/modern-go/concurrent@bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/spf13/pflag@v1.0.3: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/imdario/mergo@v0.3.7: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat sigs.k8s.io/yaml@v1.1.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat golang.org/x/text@v0.3.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/utils@21c4ce38f2a793ec01e925ddc31216500183b773: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat golang.org/x/oauth2@9f3314589c9a9136388751d9adae6b0ed400978a: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat gopkg.in/inf.v0@v0.9.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/kube-openapi@94e1e7b7574c44c4c0f2007de6fe617e259191f3: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat golang.org/x/net@b630fd6fe46bcfc98f989005d8b8ec1400e60a6e: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/csi-translation-lib@9ff632302e7ee3b0b6118cd21569ce8b51f7f0f2: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/client-go@6ee68ca5fd8355d024d02f9db0b3b667e8357a0f: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/modern-go/reflect2@4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/gogo/protobuf@v1.2.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat google.golang.org/genproto@f467c93bbac2133ff463e1f93d18d8f9f3f04451: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/golang/groupcache@5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/davecgh/go-spew@v1.1.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/klog@v0.2.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat google.golang.org/appengine@v1.5.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/kubernetes-csi/csi-test@v2.0.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/golang/protobuf@v1.3.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/kubernetes-csi/csi-lib-utils@v0.6.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat k8s.io/api@3593926aa670dfe7a2ea80cc3d5be06024eccb3e: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/golang/mock@v1.2.0: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/hashicorp/golang-lru@v0.5.1: repo version lookup disabled by -mod=vendor
go: converting Gopkg.lock: stat github.com/evanphx/json-patch@v4.1.0: repo version lookup disabled by -mod=vendor

Of course on the ppc64le machine I get:

CGO_ENABLED=0 GOOS=windows go build -a -ldflags '-X main.version=v2.0.0-0-g27b83ca -extldflags "-static"' -o ./bin/csi-attacher.exe ./cmd/csi-attacher
cmd/go: unsupported GOOS/GOARCH pair windows/ppc64le

Is there a way to disable trying to build a windows/ppc64le version? :D

@pohly
Copy link
Contributor

pohly commented Oct 4, 2019

I assumed that you had the repo checked out at $GOPATH/src/github.com/kubernetes-csi/external-attacher. This was required earlier; not sure whether it's mentioned in the README.md, though. It might not be, because it was common to all Go projects. Building without modules (the first command) only works in that location.

If you checked out elsewhere, then Go 1.12.x already uses modules by default. It's 1.13 which enables it also when used inside $GOPATH.

Is there a way to disable trying to build a windows/ppc64le version? :D

Building Windows binaries was added in kubernetes-csi/csi-release-tools#26.

@ddebroy, @msau42: what was the rationale for enabling the Windows build unconditionally? Was it for the CI? Perhaps we should reconsider what "make build" is really supposed to build, i.e. what purpose it has.

@YiannisGkoufas
Copy link
Author

Thanks @pohly for the clarifications.
By the way I am facing the same windows issue in node-driver-registar because of this line: https://github.com/kubernetes-csi/node-driver-registrar/blob/master/release-tools/build.make#L66

@ddebroy
Copy link
Contributor

ddebroy commented Oct 7, 2019

@pohly Yes, we do want Windows versions of the CSI binaries as part of CI.

I was thinking for now, adding some logic to check if GOARCH == amd64 before the Windows build step to avoid the problem above in ppc64le. That is obviously a very short term hack.

Long term, we probably need a matrix of os/arch combo like in k/k at least for the node components. Thoughts?

@ddebroy
Copy link
Contributor

ddebroy commented Oct 7, 2019

kubernetes-csi/csi-release-tools#35 should address cmd/go: unsupported GOOS/GOARCH pair windows/ppc64le

@jsafrane
Copy link
Contributor

Is this still an issue or can we close it? Release tools were updated since the bug was reported.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants