Merge pull request #98861 from tonistiigi/non-amd64-cross-compile

avoid hardcoding amd64 specifics on cross compiling
This commit is contained in:
Kubernetes Prow Robot 2021-02-09 00:45:53 -08:00 committed by GitHub
commit 141630d090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -393,11 +393,15 @@ kube::golang::set_platform_envs() {
export GOOS=${platform%/*}
export GOARCH=${platform##*/}
# Do not set CC when building natively on a platform, only if cross-compiling from linux/amd64
if [[ $(kube::golang::host_platform) == "linux/amd64" ]]; then
# Dynamic CGO linking for other server architectures than linux/amd64 goes here
# Do not set CC when building natively on a platform, only if cross-compiling
if [[ $(kube::golang::host_platform) != "$platform" ]]; then
# Dynamic CGO linking for other server architectures than host architecture goes here
# If you want to include support for more server platforms than these, add arch-specific gcc names here
case "${platform}" in
"linux/amd64")
export CGO_ENABLED=1
export CC=${KUBE_LINUX_AMD64_CC:-x86_64-linux-gnu-gcc}
;;
"linux/arm")
export CGO_ENABLED=1
export CC=${KUBE_LINUX_ARM_CC:-arm-linux-gnueabihf-gcc}