Skip to content

Commit

Permalink
fix arm/arm64 builds by enabling CGO
Browse files Browse the repository at this point in the history
Enable CGO for all arm/arm64 builds to address Go bug.

golang/go#32912

Also restrict arm(64) builds to Linux only as it is the only one anyone
is using.
  • Loading branch information
eikenb committed Sep 10, 2019
1 parent ee91205 commit d1e1dad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ GOARCH ?= $(shell go env GOARCH)
# Default os-arch combination to build
XC_OS ?= darwin freebsd linux netbsd openbsd solaris windows
XC_ARCH ?= 386 amd64 arm arm64
XC_EXCLUDE ?= darwin/arm solaris/386 solaris/arm windows/arm darwin/arm64 freebsd/arm64 netbsd/arm64 openbsd/arm64 solaris/arm64 windows/arm64
# XC_EXCLUDE "arm64" entries excludes both arm and arm64
XC_EXCLUDE ?= darwin/arm64 freebsd/arm64 netbsd/arm64 openbsd/arm64 solaris/386 solaris/arm64 windows/arm64

# GPG Signing key (blank by default, means no GPG signing)
GPG_KEY ?=
Expand All @@ -52,8 +53,15 @@ define make-xc-target
@printf "%s%20s %s\n" "-->" "${1}/${2}:" "${PROJECT} (excluded)"
else
@printf "%s%20s %s\n" "-->" "${1}/${2}:" "${PROJECT}"
case "$2" in \
arm) export CGO_ENABLED="1" ; \
export GOARM=5 \
export CC="arm-linux-gnueabi-gcc" ;; \
arm64) export CGO_ENABLED="1" ; \
export CC="aarch64-linux-gnu-gcc" ;; \
*) export CGO_ENABLED="0" ;; \
esac ; \
env \
CGO_ENABLED="0" \
GOOS="${1}" \
GOARCH="${2}" \
go build \
Expand Down

0 comments on commit d1e1dad

Please sign in to comment.