enable cross-compile CC config for non-amd64

Currently target CC can only be set if the host platform
is linux/amd64 . If target is already set in the environment
it is always safe to use it and enable cgo.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2021-01-27 18:16:28 -08:00
parent b3dd01da49
commit f19f22b43e

View File

@ -416,6 +416,13 @@ kube::golang::set_platform_envs() {
;;
esac
fi
# if CC is defined for platform then always enable it
ccenv=$(echo "$platform" | awk -F/ '{print "KUBE_" toupper($1) "_" toupper($2) "_CC"}')
if [ -n "${!ccenv-}" ]; then
export CGO_ENABLED=1
export CC="${!ccenv}"
fi
}
kube::golang::unset_platform_envs() {