Skip to content

Commit 57a4f0a

Browse files
authored
Build with GOAMD64=v2 by default for AMD64 arch. (#13311)
Backport from main branch. See #11715
1 parent f5424d2 commit 57a4f0a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
GO ?= go # if using docker, should not need to be installed/linked
2+
GOAMD64_VERSION ?= v2 # See https://go.dev/wiki/MinimumRequirements#microarchitecture-support
23
GOBINREL = build/bin
34
GOBIN = $(CURDIR)/$(GOBINREL)
45
UNAME = $(shell uname) # Supported: Darwin, Linux
@@ -34,6 +35,11 @@ ifeq ($(shell uname -s), Darwin)
3435
endif
3536
endif
3637

38+
# Configure GOAMD64 env.variable for AMD64 architecture:
39+
ifeq ($(shell uname -m),x86_64)
40+
CPU_ARCH= GOAMD64=${GOAMD64_VERSION}
41+
endif
42+
3743
# about netgo see: https://github.com/golang/go/issues/30310#issuecomment-471669125 and https://github.com/golang/go/issues/57757
3844
BUILD_TAGS = nosqlite,noboltdb
3945

@@ -48,9 +54,9 @@ PACKAGE = github.com/erigontech/erigon
4854
GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
4955
GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"
5056

51-
GOBUILD = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS)
52-
GO_DBG_BUILD = CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs
53-
GOTEST = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 $(GO) test $(GO_FLAGS) ./... -p 2
57+
GOBUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS)
58+
GO_DBG_BUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs
59+
GOTEST = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 $(GO) test $(GO_FLAGS) ./... -p 2
5460

5561
default: all
5662

0 commit comments

Comments
 (0)