7676# Disable cgo by default to make the binary statically linked.
7777CGO_ENABLED: =0
7878
79+ ifeq ($(GOARCH ) , arm64)
80+ CC:=aarch64-linux-gnu-gcc
81+ else
82+ CC:=x86_64-linux-gnu-gcc
83+ endif
84+
7985# Set default Go architecture to AMD64.
8086GOARCH ?= amd64
8187
@@ -181,7 +187,7 @@ output/linux_arm64/test/bin/%: $(PKG_SOURCES)
181187# In the future these targets should be deprecated.
182188./bin/log-counter : $(PKG_SOURCES )
183189ifeq ($(ENABLE_JOURNALD ) , 1)
184- CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=$(GOARCH) go build \
190+ CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=$(GOARCH) CC=$(CC) go build \
185191 -o bin/log-counter \
186192 -ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
187193 -tags "$(LINUX_BUILD_TAGS)" \
@@ -191,21 +197,21 @@ else
191197endif
192198
193199./bin/node-problem-detector : $(PKG_SOURCES )
194- CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH=$(GOARCH ) go build \
200+ CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH=$(GOARCH ) CC= $( CC ) go build \
195201 -o bin/node-problem-detector \
196202 -ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
197203 -tags " $( LINUX_BUILD_TAGS) " \
198204 ./cmd/nodeproblemdetector
199205
200206./test/bin/problem-maker : $(PKG_SOURCES )
201207 cd test && \
202- CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH=$(GOARCH ) go build \
208+ CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH=$(GOARCH ) CC= $( CC ) go build \
203209 -o bin/problem-maker \
204210 -tags " $( LINUX_BUILD_TAGS) " \
205211 ./e2e/problemmaker/problem_maker.go
206212
207213./bin/health-checker : $(PKG_SOURCES )
208- CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH=$(GOARCH ) go build \
214+ CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH=$(GOARCH ) CC= $( CC ) go build \
209215 -o bin/health-checker \
210216 -ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
211217 -tags " $( LINUX_BUILD_TAGS) " \
0 commit comments