From caaeaa02f7a3cfc010cc9d083febc220b49d6b5b Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 2 Apr 2021 16:29:57 -0400 Subject: [PATCH] Tweak cross compilation Make Only use cross compile if not compiling in target architecture. Also, use the latest gcc for cross compilation. --- GNUmakefile | 10 ++++++++-- scripts/vagrant-linux-priv-config.sh | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 5c6888105..b2454a752 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -72,8 +72,14 @@ endif CC=$(CC) \ go build -trimpath -ldflags $(GO_LDFLAGS) -tags "$(GO_TAGS)" -o $(GO_OUT) -pkg/linux_arm/nomad: CC = arm-linux-gnueabihf-gcc-5 -pkg/linux_arm64/nomad: CC = aarch64-linux-gnu-gcc-5 +ifneq (armv7l,$(THIS_ARCH)) +pkg/linux_arm/nomad: CC = arm-linux-gnueabihf-gcc +endif + +ifneq (aarch64,$(THIS_ARCH)) +pkg/linux_arm64/nomad: CC = aarch64-linux-gnu-gcc +endif + pkg/windows_%/nomad: GO_OUT = $@.exe # Define package targets for each of the build targets we actually have on this system diff --git a/scripts/vagrant-linux-priv-config.sh b/scripts/vagrant-linux-priv-config.sh index df144e67f..5d7126a3b 100755 --- a/scripts/vagrant-linux-priv-config.sh +++ b/scripts/vagrant-linux-priv-config.sh @@ -31,9 +31,9 @@ apt-get install -y \ apt-get install -y \ binutils-aarch64-linux-gnu \ binutils-arm-linux-gnueabihf \ - gcc-5-aarch64-linux-gnu \ - gcc-5-arm-linux-gnueabihf \ - gcc-5-multilib-arm-linux-gnueabihf + gcc-aarch64-linux-gnu \ + gcc-arm-linux-gnueabihf \ + gcc-multilib-arm-linux-gnueabihf # Install Windows build utilities apt-get install -y \