From b83589f20e7a9340be0eb3e679c6b81d8702acec Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 24 Sep 2024 19:14:07 -0700 Subject: [PATCH] Attempt using musl-gcc instead of Glibc (#826) --- .github/workflows/build-helper.yml | 2 +- .github/workflows/codeql.yml | 1 + Taskfile.yml | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-helper.yml b/.github/workflows/build-helper.yml index 108e0f482..fee5db485 100644 --- a/.github/workflows/build-helper.yml +++ b/.github/workflows/build-helper.yml @@ -37,7 +37,7 @@ jobs: if: matrix.platform == 'linux' run: | sudo apt-get update - sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools + sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools musl # The pre-installed version of the AWS CLI has a segfault problem so we'll install it via Homebrew instead. - name: Upgrade AWS CLI (Mac only) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f7786e4b9..d09070cb8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -95,6 +95,7 @@ jobs: - name: Build (Go only) if: matrix.language == 'go' run: | + sudo apt update && sudo apt install -y musl task build:server task build:wsh diff --git a/Taskfile.yml b/Taskfile.yml index 620c643b7..1eec394cb 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -94,13 +94,15 @@ tasks: vars: ARCHS: sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}} + GO_LDFLAGS: -linkmode 'external' -extldflags=-static + GO_ENV_VARS: CC=musl-gcc build:server:internal: requires: vars: - ARCHS cmd: - cmd: CGO_ENABLED=1 GOARCH={{.GOARCH}} go build -tags "osusergo,sqlite_omit_load_extension" -ldflags "{{.GO_LDFLAGS}} -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}{{exeExt}} cmd/server/main-server.go + cmd: CGO_ENABLED=1 GOARCH={{.GOARCH}} {{.GO_ENV_VARS}} go build -tags "osusergo,sqlite_omit_load_extension" -ldflags "{{.GO_LDFLAGS}} -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}{{exeExt}} cmd/server/main-server.go for: var: ARCHS split: ","