[meta-virtualization] [master][rocko][PATCH] kubernetes: fix build error for arm64
Jagadeesh Krishnanjanappa
jkrishnanjanappa at mvista.com
Tue Jan 16 22:20:15 PST 2018
The changes include:
1. Compiling go-bindata for host architecture, as it needs to be run at host
machine; which solves below error:
-- snip --
Log data follows:
| DEBUG: Executing shell function do_compile
| +++ [0117 05:06:39] Building the toolchain targets:
| k8s.io/kubernetes/hack/cmd/teststale
| k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
| +++ [0117 05:06:39] Generating bindata:
| test/e2e/generated/gobindata_util.go
| Cannot find go-bindata.
| ../../../../../../test/e2e/generated/gobindata_util.go:19: running "../../../hack/generate-bindata.sh": exit status 5
| !!! [0117 05:06:39] Call tree:
| !!! [0117 05:06:39] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
| !!! [0117 05:06:39] Call tree:
| !!! [0117 05:06:39] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
| make[1]: *** [Makefile.generated_files:322: _output/bin/deepcopy-gen] Error 1
| make: *** [Makefile:478: generated_files] Error 2
-- snip --
2. Compiling toolchain targets such as deepcopy-gen, defaulter-gen, openapi-gen
for host architecture, to solve below error:
-- snip --
| +++ [0117 05:31:35] Building go targets for linux/arm64:
| ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
| touch: cannot touch '_output/bin/deepcopy-gen': No such file or directory
| make[1]: *** [Makefile.generated_files:323: _output/bin/deepcopy-gen] Error 1
| make: *** [Makefile:478: generated_files] Error 2
-- snip --
3. Change CC value to use corresponding ${TARGET_PREFIX}gcc.
4. Check for existence of kubernetes binaries, before installing.
Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
---
.../build-kube-toolchain-to-run-on-host.patch | 38 ++++++++++++++++++++++
recipes-containers/kubernetes/kubernetes_git.bb | 14 ++++++--
2 files changed, 50 insertions(+), 2 deletions(-)
create mode 100644 recipes-containers/kubernetes/files/build-kube-toolchain-to-run-on-host.patch
diff --git a/recipes-containers/kubernetes/files/build-kube-toolchain-to-run-on-host.patch b/recipes-containers/kubernetes/files/build-kube-toolchain-to-run-on-host.patch
new file mode 100644
index 0000000..2163d4a
--- /dev/null
+++ b/recipes-containers/kubernetes/files/build-kube-toolchain-to-run-on-host.patch
@@ -0,0 +1,38 @@
+Compiling go-bindata for host architecture, as it needs to be run at host
+machine; which solves below error:
+
+-- snip --
+Log data follows:
+| DEBUG: Executing shell function do_compile
+| +++ [0117 05:06:39] Building the toolchain targets:
+| k8s.io/kubernetes/hack/cmd/teststale
+| k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata
+| +++ [0117 05:06:39] Generating bindata:
+| test/e2e/generated/gobindata_util.go
+| Cannot find go-bindata.
+| ../../../../../../test/e2e/generated/gobindata_util.go:19: running "../../../hack/generate-bindata.sh": exit status 5
+| !!! [0117 05:06:39] Call tree:
+| !!! [0117 05:06:39] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
+| !!! [0117 05:06:39] Call tree:
+| !!! [0117 05:06:39] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
+| make[1]: *** [Makefile.generated_files:322: _output/bin/deepcopy-gen] Error 1
+| make: *** [Makefile:478: generated_files] Error 2
+-- snip --
+
+Upstream-Status: Inappropriate [embedded-specific]
+
+Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
+--- a/src/import/hack/lib/golang.sh 2018-01-10 21:20:47.803156778 +0530
++++ b/src/import/hack/lib/golang.sh 2018-01-10 21:35:04.228444126 +0530
+@@ -682,8 +682,11 @@ kube::golang::build_binaries() {
+ fi
+ fi
+
++ local goarch_backup=${GOARCH}
++ export GOARCH=$(go env GOHOSTARCH)
+ # First build the toolchain before building any other targets
+ kube::golang::build_kube_toolchain
++ export GOARCH="$goarch_backup"
+
+ kube::log::status "Generating bindata:" "${KUBE_BINDATAS[@]}"
+ for bindata in ${KUBE_BINDATAS[@]}; do
diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb
index 4a825ba..f0c5be3 100644
--- a/recipes-containers/kubernetes/kubernetes_git.bb
+++ b/recipes-containers/kubernetes/kubernetes_git.bb
@@ -7,7 +7,7 @@ maintenance, and scaling of applications. \
SRCREV_kubernetes = "4b839465f84e7faf876c51703aaf49b37fd10d9c"
SRC_URI = "git://github.com/kubernetes/kubernetes.git;nobranch=1;name=kubernetes \
- "
+ file://build-kube-toolchain-to-run-on-host.patch"
DEPENDS += "rsync-native \
coreutils-native \
@@ -42,6 +42,7 @@ inherit go
inherit goarch
do_compile() {
+ sed -i "s:export CC=.*-gcc$:export CC=${HOST_PREFIX}gcc:g" ${S}/src/import/hack/lib/golang.sh
export GOARCH="${TARGET_GOARCH}"
export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
export GOPATH="${S}/src/import:${S}/src/import/vendor"
@@ -68,6 +69,11 @@ do_compile() {
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
cd ${S}/src/import
+ export KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${BUILD_GOARCH}"
+ export GOARCH="${BUILD_GOARCH}"
+ make generated_files
+ export KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${TARGET_GOARCH}"
+ export GOARCH="${TARGET_GOARCH}"
# to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
make all
}
@@ -79,7 +85,11 @@ do_install() {
install -d ${D}${sysconfdir}/kubernetes/manifests/
- install -m 755 -D ${S}/src/import/_output/bin/kube* ${D}/${bindir}
+ if ls ${S}/src/import/_output/local/bin/*/${TARGET_GOARCH}/kube* > /dev/null 2>&1 ; then
+ install -m 755 -D ${S}/src/import/_output/local/bin/*/${TARGET_GOARCH}/kube* ${D}/${bindir}
+ elif ls ${S}/src/import/_output/bin/kube* > /dev/null 2>&1 ; then
+ install -m 755 -D ${S}/src/import/_output/bin/kube* ${D}/${bindir}
+ fi
install -m 0644 ${S}/src/import/build/debs/kubelet.service ${D}${systemd_unitdir}/system/
install -m 0644 ${S}/src/import/build/debs/10-kubeadm.conf ${D}${systemd_unitdir}/system/kubelet.service.d/
--
2.7.4
More information about the meta-virtualization
mailing list