From 55b15a06e5e3b7ab30b31f815f9753d059299b8c Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 9 Jul 2020 14:37:27 +0000 Subject: 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 --- recipes-containers/kubernetes/kubernetes_git.bb | 16 ++++++++++++---- 1 file 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() { export GOARCH="${BUILD_GOARCH}" # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries export CGO_ENABLED="1" - export CFLAGS="" - export LDFLAGS="" - export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CFLAGS="${BUILD_CFLAGS}" + export LDFLAGS="${BUILD_LDFLAGS}" + export CGO_CFLAGS="${BUILD_CFLAGS}" + export CGO_LDFLAGS="${BUILD_LDFLAGS}" + export CC="${BUILD_CC}" + export LD="${BUILD_LD}" + make generated_files KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${BUILD_GOARCH}" # Build the target binaries @@ -54,6 +57,11 @@ do_compile() { export CGO_ENABLED="1" export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CFLAGS="" + export LDFLAGS="" + export CC="${CC}" + export LD="${LD}" + # to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH} GOLDFLAGS="" } -- cgit v1.2.3-54-g00ecf