kubernetes: explicitly build for $TARGET_ARCH

'make all' uses 'uname' to select the build target, leading to compile failures like this:

| arm-angstrom-linux-gnueabi-gcc: error: unrecognized command line option '-m64'

After providing the proper arch to the makefile it will try to use a hardcoded compiler:

| # runtime/cgo
| exec: "arm-linux-gnueabihf-gcc": executable file not found in $PATH

Fix that up by removing all hardcoded 'CC' entries in golang.sh

Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Koen Kooi 2018-07-23 16:10:23 +02:00 committed by Bruce Ashfield
parent 10a427cadd
commit 0e4cd43ccb
2 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,40 @@
From 9cbb2d523d481053d405ebac830c2074b00d3417 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen.kooi@linaro.org>
Date: Mon, 23 Jul 2018 15:28:02 +0200
Subject: [PATCH] hack/lib/golang.sh: use CC from environment
Toolchain tupples differs, especially when using vendor provides ones.
Upstream-status: Inappropriate [embedded specific]
Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
---
hack/lib/golang.sh | 4 ----
1 file changed, 4 deletions(-)
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
index c5d4634..563e2b4b 100755
--- a/src/import/hack/lib/golang.sh
+++ b/src/import/hack/lib/golang.sh
@@ -278,19 +278,15 @@ kube::golang::set_platform_envs() {
case "${platform}" in
"linux/arm")
export CGO_ENABLED=1
- export CC=arm-linux-gnueabihf-gcc
;;
"linux/arm64")
export CGO_ENABLED=1
- export CC=aarch64-linux-gnu-gcc
;;
"linux/ppc64le")
export CGO_ENABLED=1
- export CC=powerpc64le-linux-gnu-gcc
;;
"linux/s390x")
export CGO_ENABLED=1
- export CC=s390x-linux-gnu-gcc
;;
esac
fi
--
2.9.5

View File

@ -7,6 +7,7 @@ maintenance, and scaling of applications. \
SRCREV_kubernetes = "210c9cd7e1782e9fe46938fe0368556f2166a528"
SRC_URI = "git://github.com/kubernetes/kubernetes.git;branch=release-1.11;name=kubernetes \
file://0001-hack-lib-golang.sh-use-CC-from-environment.patch \
"
DEPENDS += "rsync-native \
@ -46,6 +47,7 @@ inherit goarch
do_compile() {
export GOARCH="${TARGET_GOARCH}"
export GOOS="${TARGET_GOOS}"
export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
export GOPATH="${S}/src/import:${S}/src/import/vendor"
@ -72,7 +74,7 @@ do_compile() {
cd ${S}/src/import
# to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
make all
make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH}
}
do_install() {
@ -82,7 +84,7 @@ do_install() {
install -d ${D}${sysconfdir}/kubernetes/manifests/
install -m 755 -D ${S}/src/import/_output/bin/kube* ${D}/${bindir}
install -m 755 -D ${S}/src/import/_output/local/bin/${TARGET_GOOS}/${TARGET_GOARCH}/* ${D}/${bindir}
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/