kubernetes: build host tools using host toolchain

Compile host tools 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

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Jagadeesh Krishnanjanappa 2018-07-23 16:48:48 +02:00 committed by Bruce Ashfield
parent 0e4cd43ccb
commit ba25e5c943

View File

@ -73,6 +73,12 @@ do_compile() {
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
cd ${S}/src/import
# Build the host tools first, using the host compiler
export GOARCH="${BUILD_GOARCH}"
make generated_files KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${BUILD_GOARCH}"
# Reset GOARCH to the target one
export GOARCH="${TARGET_GOARCH}"
# to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH}
}