Skip to content

Commit

Permalink
Use CGO_ENABLED=1 when building natively on darwin
Browse files Browse the repository at this point in the history
Need to use CGO for mDNS resolution, but cross builds need CGO disabled
See golang/go#12524 for details

Note: Homebrew forumla will need to be updated to pick up this change

Fixes containers#10737

Signed-off-by: Jhon Honce <jhonce@redhat.com>
  • Loading branch information
jwhonce committed Oct 14, 2021
1 parent ac73303 commit e4a89d4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Expand Up @@ -176,6 +176,14 @@ define go-get
$(GO) get -u ${1}
endef

# Need to use CGO for mDNS resolution, but cross builds need CGO disabled
# See https://github.com/golang/go/issues/12524 for details
ifeq ($(NATIVE_GOOS),darwin)
DARWIN_GCO := 1
else
DARWIN_GCO := 0
endif

###
### Primary entry-point targets
###
Expand Down Expand Up @@ -351,7 +359,7 @@ podman-remote-windows: ## Build podman-remote for Windows
.PHONY: podman-remote-darwin
podman-remote-darwin: ## Build podman-remote for macOS
$(MAKE) \
CGO_ENABLED=0 \
CGO_ENABLED=$(DARWIN_GCO) \
GOOS=darwin \
GOARCH=$(GOARCH) \
bin/darwin/podman
Expand Down

0 comments on commit e4a89d4

Please sign in to comment.