From d8d86b0a64d05b027bddcf78fdad387b86611483 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 30 Dec 2020 12:00:46 +0000 Subject: [PATCH] Simplify Go cross-compile settings We only want to force CGO_ENABLED when cross-compiling for arm; it is on by default for native linux compilation and off by default for darwin cross-compilation. --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f6d5367e3..b432bd18b 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,9 @@ BUILD_IN_CONTAINER=true GO_ENV=GOGC=off GO_BUILD_TAGS='netgo unsafe' GO_BUILD_FLAGS=-mod vendor -ldflags "-extldflags \"-static\" -X main.version=$(SCOPE_VERSION) -s -w" -tags $(GO_BUILD_TAGS) -GOOS=$(shell go tool dist env | grep GOOS | sed -e 's/GOOS="\(.*\)"/\1/') - -ifeq ($(GOOS),linux) -GO_ENV+=CGO_ENABLED=1 -endif ifeq ($(GOARCH),arm) +GO_ENV+=CGO_ENABLED=1 ARM_CC=CC=/usr/bin/arm-linux-gnueabihf-gcc endif