Skip to content

Commit c473896

Browse files
authored
set CGO_ENABLED=0 when building release artifacts (#60)
Signed-off-by: James Lamb <[email protected]>
1 parent a4f5c79 commit c473896

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ build: ## Build for the current platform
1717
@echo version: $(VERSION)
1818
@echo commit: $(COMMIT)
1919

20+
# NOTE: Linux builds set CGO_ENABLED=0 to avoid dynamic linking against libc,
21+
# which can cause issues of the form "version `GLIBC_2.32' not found" when using
22+
# the package on systems that are older than where it was built.
2023
package: ## Build for all platforms
2124
env GOOS=windows GOARCH=amd64 go build -o bin/$(EXECUTABLE)_windows_amd64.exe $(GO_FLAGS) .
22-
env GOOS=linux GOARCH=amd64 go build -o bin/$(EXECUTABLE)_linux_amd64 $(GO_FLAGS) .
23-
env GOOS=linux GOARCH=arm64 go build -o bin/$(EXECUTABLE)_linux_arm64 $(GO_FLAGS) .
25+
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/$(EXECUTABLE)_linux_amd64 $(GO_FLAGS) .
26+
env GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o bin/$(EXECUTABLE)_linux_arm64 $(GO_FLAGS) .
2427
env GOOS=darwin GOARCH=amd64 go build -o bin/$(EXECUTABLE)_darwin_amd64 $(GO_FLAGS) .
2528
env GOOS=darwin GOARCH=arm64 go build -o bin/$(EXECUTABLE)_darwin_arm64 $(GO_FLAGS) .
2629
@echo built: bin/$(EXECUTABLE)_windows_amd64.exe, bin/$(EXECUTABLE)_linux_amd64, bin/$(EXECUTABLE)_linux_arm64, bin/$(EXECUTABLE)_darwin_amd64, bin/$(EXECUTABLE)_darwin_arm64

0 commit comments

Comments
 (0)