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

cmd/cgo: regression in Kubernetes build on ppc64le due to commit 90df377 #28772

Closed
laboger opened this issue Nov 13, 2018 · 4 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@laboger
Copy link
Contributor

laboger commented Nov 13, 2018

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

Failure starts with this commit and succeeds with the commit prior.
go version devel +90df377 Thu Nov 1 21:54:54 2018 +0000 linux/ppc64le

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/home/boger/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/boger/gowork"
GOPROXY=""
GORACE=""
GOROOT="/home/boger/golang/upstream/go"
GOTMPDIR=""
GOTOOLDIR="/home/boger/golang/upstream/go/pkg/tool/linux_ppc64le"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build366428456=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Build of Kubernetes with upstream golang started failing with the above commit.
To reproduce the build:

  1. Build the upstream master go and make available in $PATH
  2. Clone upstream kubenets and run below
    cd $GOPATH/src/k8s.io
    git clone https://github.com/kubernetes/kubernetes.git
    export K8S_DIR=${GOPATH}/src/k8s.io/kubernetes
    export K8S_BIN=${K8S_DIR}/_output/bin
    cd ${K8S_DIR}
    make all

What did you expect to see?

Successful build

What did you see instead?

    test/e2e/e2e.test
    cmd/kubemark
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e_node/e2e_node.test
# k8s.io/kubernetes/vendor/github.com/mindprince/gonvml
vendor/github.com/mindprince/gonvml/bindings.go:361:143: cannot use _cgo2 (type int) as type _Ctype_uint in argument to _Cfunc_nvmlDeviceGetUUID
vendor/github.com/mindprince/gonvml/bindings.go:371:143: cannot use _cgo2 (type int) as type _Ctype_uint in argument to _Cfunc_nvmlDeviceGetName
!!! [1103 07:08:41] Call tree:
!!! [1103 07:08:41]  1: /root/workspace/test-kubernetes-master/k8s_ws/src/k8s.io/kubernetes/hack/lib/golang.sh:616 kube::golang::build_some_binaries(...)
!!! [1103 07:08:41]  2: /root/workspace/test-kubernetes-master/k8s_ws/src/k8s.io/kubernetes/hack/lib/golang.sh:752 kube::golang::build_binaries_for_platform(...)
!!! [1103 07:08:41]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1103 07:08:41] Call tree:
!!! [1103 07:08:41]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1103 07:08:41] Call tree:
!!! [1103 07:08:41]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
Makefile:92: recipe for target 'all' failed
make: *** [all] Error 1

@ianlancetaylor

@bradfitz
Copy link
Contributor

bradfitz commented Nov 13, 2018

Easier repro, not involving Kubernetes:

bradfitz@gdev:~$ GOROOT=$HOME/go1.10 go get -u github.com/mindprince/gonvml
bradfitz@gdev:~$ GOROOT=$HOME/go1.11 go get -u github.com/mindprince/gonvml
bradfitz@gdev:~$ GOROOT=$HOME/go go get -u github.com/mindprince/gonvml
# github.com/mindprince/gonvml
src/github.com/mindprince/gonvml/bindings.go:409:143: cannot use _cgo2 (type int) as type _Ctype_uint in argument to _Cfunc_nvmlDeviceGetUUID
src/github.com/mindprince/gonvml/bindings.go:419:143: cannot use _cgo2 (type int) as type _Ctype_uint in argument to _Cfunc_nvmlDeviceGetName

(And in case that repro changes, this repro'd for me at its git rev b364b296c7320f5d3dc084aa536a3dba33b68f90)

@bradfitz bradfitz added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Nov 13, 2018
@bradfitz bradfitz added this to the Go1.12 milestone Nov 13, 2018
@ianlancetaylor
Copy link
Member

Standalone reproduction:

package p

/*
#define constant 1
static void function(char **p, unsigned int i) {}
*/
import "C"

const constant = C.constant

func F() {
	var pc *C.char
	C.function(&pc, constant)
}

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/149858 mentions this issue: cmd/cgo: recognized untyped Go constants as untyped constants

bradfitz pushed a commit that referenced this issue Nov 21, 2018
Fixes #28772

Change-Id: I9446d95fb73fbcbb1cd9a4d2156ebc91bc9e91cb
Reviewed-on: https://go-review.googlesource.com/c/149858
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/151600 mentions this issue: cmd/cgo: recognize untyped constants defined in different files

gopherbot pushed a commit that referenced this issue Nov 29, 2018
An untyped constant can be defined in any input file, we shouldn't
segregate them by file.

Updates #28772

Change-Id: I0347f15236833bb511eb49f86c449ee9241b0a25
Reviewed-on: https://go-review.googlesource.com/c/151600
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
@golang golang locked and limited conversation to collaborators Nov 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants