summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-07-09 14:37:27 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-07-10 14:52:05 +0000
commit55b15a06e5e3b7ab30b31f815f9753d059299b8c (patch)
treeef54d4ca7067aa2ae1f83a9b3c4a84cd77a935e4
parent16ec6ab62c5f41541092318170e0221e7ce0da89 (diff)
downloadmeta-virtualization-55b15a06e5e3b7ab30b31f815f9753d059299b8c.tar.gz
kubernetes: fix ARM64 build
The first part of the kubernetes build generates some host/build files. These use the build/host compiler and not the cross infrastructure. It was working by luck on x86 build / target matches, but blows up on an ARM64 build. We fix the CC/CFLAGS settings for the host part of the build to use the host/build flags and then restore the cross settings for the rest of the build. Tested on arm64 and x86-64. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-containers/kubernetes/kubernetes_git.bb16
1 files changed, 12 insertions, 4 deletions
diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb
index 6292b36c..d28e6a25 100644
--- a/recipes-containers/kubernetes/kubernetes_git.bb
+++ b/recipes-containers/kubernetes/kubernetes_git.bb
@@ -42,10 +42,13 @@ do_compile() {
42 export GOARCH="${BUILD_GOARCH}" 42 export GOARCH="${BUILD_GOARCH}"
43 # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries 43 # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries
44 export CGO_ENABLED="1" 44 export CGO_ENABLED="1"
45 export CFLAGS="" 45 export CFLAGS="${BUILD_CFLAGS}"
46 export LDFLAGS="" 46 export LDFLAGS="${BUILD_LDFLAGS}"
47 export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" 47 export CGO_CFLAGS="${BUILD_CFLAGS}"
48 export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" 48 export CGO_LDFLAGS="${BUILD_LDFLAGS}"
49 export CC="${BUILD_CC}"
50 export LD="${BUILD_LD}"
51
49 make generated_files KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${BUILD_GOARCH}" 52 make generated_files KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${BUILD_GOARCH}"
50 53
51 # Build the target binaries 54 # Build the target binaries
@@ -54,6 +57,11 @@ do_compile() {
54 export CGO_ENABLED="1" 57 export CGO_ENABLED="1"
55 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" 58 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
56 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" 59 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
60 export CFLAGS=""
61 export LDFLAGS=""
62 export CC="${CC}"
63 export LD="${LD}"
64
57 # to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet 65 # to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
58 make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH} GOLDFLAGS="" 66 make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH} GOLDFLAGS=""
59} 67}