Skip to content

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

Closed

Description

@laboger

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

Activity

  1. bradfitz commented on Nov 13, 2018

    @bradfitz
    Contributor

    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)

  2. added this to the Go1.12 milestone on Nov 13, 2018
  3. ianlancetaylor commented on Nov 16, 2018

    @ianlancetaylor
    Contributor

    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)
    }
  4. gopherbot commented on Nov 16, 2018

    @gopherbot
    Contributor

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

  5. added a commit that references this issue on Nov 21, 2018
    ba8f6fa
  6. gopherbot commented on Nov 29, 2018

    @gopherbot
    Contributor

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

  7. locked and limited conversation to collaborators on Nov 29, 2019
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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions