What version of Go are you using (go version)?
$ go version
go version go1.20 linux/amd64
Does this issue reproduce with the latest release?
Yes, by cross compiling kubernetes/kubernetes@b7ad179 to the linux/arm platform.
What operating system and processor architecture are you using (go env)?
We build in a custom container image registry.k8s.io/build-image/kube-cross
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/go/src/k8s.io/kubernetes/.cache/go-build"
GOENV="/go/src/k8s.io/kubernetes/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fdebug-prefix-map=/tmp.k8s/go-build942910395=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Running make release in the root of the Kubernetes repository. Everything gets built successfully, except the k8s.io/kubernetes/test/e2e_node.test, which fails with:
/usr/local/go/pkg/tool/linux_amd64/link: running arm-linux-gnueabihf-gcc failed: exit status 1
/tmp.k8s/go-link-865684912/go.o: in function `k8s.io/kubernetes/vendor/github.com/aws/aws-sdk-go/service/ec2.(*ModifyCapacityReservationInput).GoString':
go.go:(.text+0x207ca88): relocation truncated to fit: R_ARM_CALL against `runtime.duffcopy'
go.go:(.text+0x207ca94): relocation truncated to fit: R_ARM_CALL against `runtime.duffcopy'
collect2: error: ld returned 1 exit status
A small patch can be applied to make it fail faster for reproduction:
diff --git a/hack/make-rules/cross.sh b/hack/make-rules/cross.sh
index f8a6d0dbf5e..1a7a19ff307 100755
--- a/hack/make-rules/cross.sh
+++ b/hack/make-rules/cross.sh
@@ -27,12 +27,12 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
# NOTE: Using "${array[*]}" here is correct. [@] becomes distinct words (in
# bash parlance).
-make all WHAT="${KUBE_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
+#make all WHAT="${KUBE_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
-make all WHAT="${KUBE_NODE_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_NODE_PLATFORMS[*]}"
+#make all WHAT="${KUBE_NODE_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_NODE_PLATFORMS[*]}"
-make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}"
+#make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}"
-make all WHAT="${KUBE_TEST_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_PLATFORMS[*]}"
+#make all WHAT="${KUBE_TEST_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_PLATFORMS[*]}"
-make all WHAT="${KUBE_TEST_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_SERVER_PLATFORMS[*]}"
+make all WHAT="test/e2e_node/e2e_node.test" KUBE_BUILD_PLATFORMS="linux/arm"
Setting CGO_CFLAGS=-mlong-calls does not help, disabling CGO does provide a workaround.
Source code changes seem to have impact on the issue, because the build works with the next commit kubernetes/kubernetes@b0171f7
Ref: kubernetes/kubernetes#115613, kubernetes/kubernetes#115605
What did you expect to see?
That the test binary compiles correctly with CGO enabled.
What did you see instead?
The link failure.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes, by cross compiling kubernetes/kubernetes@b7ad179 to the
linux/armplatform.What operating system and processor architecture are you using (
go env)?We build in a custom container image registry.k8s.io/build-image/kube-cross
go envOutputWhat did you do?
Running
make releasein the root of the Kubernetes repository. Everything gets built successfully, except thek8s.io/kubernetes/test/e2e_node.test, which fails with:A small patch can be applied to make it fail faster for reproduction:
Setting
CGO_CFLAGS=-mlong-callsdoes not help, disabling CGO does provide a workaround.Source code changes seem to have impact on the issue, because the build works with the next commit kubernetes/kubernetes@b0171f7
Ref: kubernetes/kubernetes#115613, kubernetes/kubernetes#115605
What did you expect to see?
That the test binary compiles correctly with CGO enabled.
What did you see instead?
The link failure.