Tweak cross compilation Make

Only use cross compile if not compiling in target architecture.

Also, use the latest gcc for cross compilation.
This commit is contained in:
Mahmood Ali
2021-04-02 16:29:57 -04:00
parent 3db2f2f9f5
commit caaeaa02f7
2 changed files with 11 additions and 5 deletions

View File

@@ -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

View File

@@ -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 \