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/compile: relocation target ... not defined while building targets for kubernetes with go tip #44629

Closed
Rajalakshmi-Girish opened this issue Feb 26, 2021 · 8 comments

Comments

@Rajalakshmi-Girish
Copy link

@Rajalakshmi-Girish Rajalakshmi-Girish commented Feb 26, 2021

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

$ go version
go version devel +e25040d162 Fri Feb 26 02:52:33 2021 +0000 linux/ppc64le

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

Operating system: Linux
Architecture: ppc64le and amd64

What did you do?

Building targets for kubernetes using the latest golang in main branch

What did you expect to see?

Kubernetes binaries build without error

What did you see instead?

Below error:

-bash: build-log.txt: command not found
^C[root@rajalakshmi-workspace kubernetes]# make cross 2>&1 | tee build-log.txt
+++ [0226 08:39:26] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen
Generating prerelease lifecycle code for 24 targets
+++ [0226 08:39:32] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
Generating deepcopy code for 226 targets
+++ [0226 08:39:42] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/defaulter-gen
Generating defaulter code for 88 targets
+++ [0226 08:39:56] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/conversion-gen
Generating conversion code for 123 targets
+++ [0226 08:40:23] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/kube-openapi/cmd/openapi-gen
Generating openapi code for KUBE
Generating openapi code for AGGREGATOR
Generating openapi code for APIEXTENSIONS
Generating openapi code for CODEGEN
Generating openapi code for SAMPLEAPISERVER
+++ [0226 08:40:43] Building go targets for linux/ppc64le:
    ./vendor/github.com/go-bindata/go-bindata/go-bindata
+++ [0226 08:40:45] Building go targets for linux/ppc64le:
    cmd/kube-proxy
    cmd/kube-apiserver
    cmd/kube-controller-manager
    cmd/kubelet
    cmd/kubeadm
    cmd/kube-scheduler
    vendor/k8s.io/kube-aggregator
    vendor/k8s.io/apiextensions-apiserver
    cluster/gce/gci/mounter
+++ [0226 08:46:53] Building go targets for linux/ppc64le:
    cmd/kube-proxy
    cmd/kubeadm
    cmd/kubelet
+++ [0226 08:47:19] Building go targets for linux/ppc64le:
    cmd/kubectl
    cmd/kubectl-convert
+++ [0226 08:47:49] Building go targets for linux/ppc64le:
    cmd/gendocs
    cmd/genkubedocs
    cmd/genman
    cmd/genyaml
    cmd/genswaggertypedocs
    cmd/linkcheck
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e/e2e.test
    cluster/images/conformance/go-runner
+++ [0226 08:51:42] Building go targets for linux/ppc64le:
    cmd/kubemark
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e_node/e2e_node.test
# k8s.io/kubernetes/test/e2e_node.test
k8s.io/kubernetes/vendor/go.etcd.io/etcd/etcdserver/api/v3client.New.func1·f: relocation target k8s.io/kubernetes/vendor/go.etcd.io/etcd/etcdserver/api/v3client.New.func1 not defined
!!! [0226 08:52:30] Call tree:
!!! [0226 08:52:30]  1: /root/kubernetes/hack/lib/golang.sh:875 kube::golang::build_binaries_for_platform(...)
!!! [0226 08:52:30]  2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0226 08:52:30] Call tree:
!!! [0226 08:52:30]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0226 08:52:30] Call tree:
!!! [0226 08:52:30]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make[1]: *** [Makefile:92: all] Error 1
make: *** [Makefile:508: cross] Error 1
[root@rajalakshmi-workspace kubernetes]#
@Rajalakshmi-Girish
Copy link
Author

@Rajalakshmi-Girish Rajalakshmi-Girish commented Feb 26, 2021

Loading

@seankhliao seankhliao changed the title Error while building targets for kubernetes with master go cmd/compile: relocation target ... not defined while building targets for kubernetes with go tip Feb 26, 2021
@laboger
Copy link
Contributor

@laboger laboger commented Mar 1, 2021

Loading

@pmur
Copy link
Contributor

@pmur pmur commented Mar 1, 2021

Looking into this. I see a relocation to the missing function in the objdump from the build cache, but the function is missing. Looking it's name, it should be also be present in the same object file?

TEXT go.etcd.io/etcd/etcdserver/api/v3client.New.func2(SB) gofile../home/murp/git/go-test/tmp-test/k8/src/k8s.io/kubernetes/vendor/go.etcd.io/etcd/clientv3/maintenance.go
  maintenance.go:100    0x167c3                 e86b0008                MOVD 8(R11),R3          
  maintenance.go:100    0x167c7                 e88b0010                MOVD 16(R11),R4         
  maintenance.go:101    0x167cb                 f8610030                MOVD R3,48(R1)          
  maintenance.go:101    0x167cf                 f8810038                MOVD R4,56(R1)          
  maintenance.go:101    0x167d3                 3fe00000                ADDIS $0,$0,R31         [0:8]R_ADDRPOWER:go.etcd.io/etcd/etcdserver/api/v3client.New.func1·f    
  maintenance.go:101    0x167d7                 387f0000                ADD R31,$0,R3           
  maintenance.go:101    0x167db                 f8610040                MOVD R3,64(R1)          
  maintenance.go:101    0x167df                 f8010048                MOVD R0,72(R1)          
  maintenance.go:101    0x167e3                 f8010050                MOVD R0,80(R1)          
  maintenance.go:101    0x167e7                 4e800020                RET                     
  maintenance.go:101    0x167eb                 00000000                WORD $0                 
  maintenance.go:101    0x167ef                 00000000                WORD $0 

Loading

@pmur
Copy link
Contributor

@pmur pmur commented Mar 1, 2021

Simple test case:

bar/b.go:

package bar

type Bar struct {
        F func ()
}

func BuildBar() Bar {
        ret := Bar{ F: func() {} }
        return ret
}

main.go:

package main

import (
        "fmt"
        "example.com/local/foo"
)

func main() {
        fmt.Printf("%v\n",foo.New(1))
}

foo/a.go:

package foo

import (
        "example.com/local/bar"
)

type Foo struct {
        b bar.Bar
}

func New(a int) Foo {
        return Foo{b: bar.BuildBar() }
}

Loading

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 2, 2021

@pmur Your test case builds for me with GOARCH=ppc64le go build. How are you building it, and what error do you see? Thanks.

Loading

@pmur
Copy link
Contributor

@pmur pmur commented Mar 2, 2021

@ianlancetaylor Here are the other details I should have included too go version devel +a400eb3261 Mon Mar 1 15:24:01 2021 +0000 linux/ppc64le

>go build
main.main.func1·f: relocation target main.main.func1 not defined

go.mod:

module example.com/local

go 1.17

Loading

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 2, 2021

This might be a dup of #44330, which was fixed since the revision that you are testing.

Loading

@pmur
Copy link
Contributor

@pmur pmur commented Mar 2, 2021

@ianlancetaylor yes, this is a duplicate. I verified my test case and kubernetes compile after cherry-picking the commit in #44330. This issue can be closed. Thank you for pointing out that issue.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants