From f51fcb409f88816be7ef3011beab605901e668ae Mon Sep 17 00:00:00 2001 From: Mariusz Wilk Date: Sun, 8 Mar 2026 13:12:33 +0100 Subject: [PATCH] CGO macos --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4996385..9cb5059 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -180,7 +180,7 @@ jobs: - name: Build binary env: - CGO_ENABLED: 0 + CGO_ENABLED: 1 GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} VERSION: ${{ steps.version.outputs.version }} @@ -189,6 +189,13 @@ jobs: OUTPUT_DIR="build/iptw-$VERSION-$GOOS-$GOARCH" mkdir -p "$OUTPUT_DIR" + # fyne.io/systray requires CGO on macOS (Objective-C/Cocoa). + # When cross-compiling for amd64 on an arm64 runner, pass -arch x86_64 to clang. + if [ "$GOARCH" = "amd64" ]; then + export CGO_CFLAGS="-arch x86_64" + export CGO_LDFLAGS="-arch x86_64" + fi + LDFLAGS="-X main.Version=$VERSION -X main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X main.GitCommit=$(git rev-parse --short HEAD) -w -s" echo "Building for $GOOS/$GOARCH..."