Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set CGO_ENABLED=0 when building release artifacts #60

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ build: ## Build for the current platform
@echo version: $(VERSION)
@echo commit: $(COMMIT)

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