From ad75dfb9352647313bc4f91759d020c973993bd2 Mon Sep 17 00:00:00 2001 From: devrel-ditto <262946657+devrel-ditto@users.noreply.github.com> Date: Fri, 20 Mar 2026 23:14:51 +0000 Subject: [PATCH] fix: statically link Linux amd64 binary with musl The release binary requires glibc 2.38+ because ubuntu-latest (24.04) dynamically links against its system glibc. This breaks on Amazon Linux 2023, Ubuntu 22.04, RHEL 9, and other common distros. Switch Linux amd64 builds to musl-gcc with static linking, producing a portable binary that runs on any Linux distro. Fixes #22 --- .github/workflows/release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0821517..aea6e92 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,9 @@ jobs: - runner: ubuntu-latest goos: linux goarch: amd64 - cc: gcc + cc: musl-gcc + cross_deps: musl-tools + static: true - runner: ubuntu-latest goos: linux goarch: arm64 @@ -53,8 +55,12 @@ jobs: CGO_CFLAGS: "-O2 -D__BLST_PORTABLE__" run: | VERSION="${GITHUB_REF_NAME#v}" + LDFLAGS="-s -w -X github.com/ava-labs/platform-cli/cmd.version=${VERSION}" + if [ "${{ matrix.static }}" = "true" ]; then + LDFLAGS="${LDFLAGS} -linkmode external -extldflags '-static'" + fi go build -tags ledger \ - -ldflags "-s -w -X github.com/ava-labs/platform-cli/cmd.version=${VERSION}" \ + -ldflags "${LDFLAGS}" \ -o platform . - name: Package tarball