From e9cb25a145a3fc3224a5a30bcd642f90e84b5edb Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 10 Jan 2025 13:59:12 -0800 Subject: [PATCH 1/5] Use Zig for ARM64 Linux builds --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index d1212deebc..8ede6852fa 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -162,7 +162,7 @@ tasks: ARCHS: sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}} GO_ENV_VARS: - sh: echo "{{if eq "amd64" ARCH}}CC=\"zig cc -target x86_64-linux-gnu.2.28\"{{end}}" + sh: echo "{{if eq "amd64" ARCH}}CC=\"zig cc -target x86_64-linux-gnu.2.28\"{{else}}CC=\"zig cc -target aarch64-linux-gnu.2.28\"{{end}}" build:server:internal: requires: From 7d23672e8b0ef2ee75df1b6fe5c72ebc9277084b Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 10 Jan 2025 14:35:56 -0800 Subject: [PATCH 2/5] Add Windows GNU zig targets --- .github/workflows/build-helper.yml | 6 +++++- BUILD.md | 8 +++----- Taskfile.yml | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-helper.yml b/.github/workflows/build-helper.yml index ada14a17cc..75b36dd057 100644 --- a/.github/workflows/build-helper.yml +++ b/.github/workflows/build-helper.yml @@ -38,7 +38,11 @@ jobs: sudo apt-get update sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools sudo snap install snapcraft --classic - sudo snap install zig --classic --beta # We use Zig instead of glibc for cgo compilation as it is more-easily statically linked + sudo snap install zig --classic # We use Zig instead of glibc for cgo compilation as it is more-easily statically linked + - name: Install Windows Build Dependencies (Windows only) + if: matrix.platform == 'windows' + run: | + choco install -y zig # 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/BUILD.md b/BUILD.md index fe7f442f63..743a6b57ec 100644 --- a/BUILD.md +++ b/BUILD.md @@ -20,7 +20,7 @@ Debian/Ubuntu: ```sh sudo apt install zip snapd -sudo snap install zig --classic --beta +sudo snap install zig --classic ``` Fedora/RHEL: @@ -50,11 +50,9 @@ For packaging, the following additional packages are required: #### Windows -You will need the GNU build toolchain installed in order for Go to work on Windows. In most cases, this requires installing MinGW-w64. +You will need the Zig [Zig](https://ziglang.org/) compiler for statically linking CGO. -The easiest way to install this is using MSYS2: https://www.msys2.org/ - -If you prefer an alternative method, you can find other methods here: https://www.mingw-w64.org/downloads/ +You can find installation instructions for Zig on Windows [here](https://ziglang.org/learn/getting-started/#managers). ### Task diff --git a/Taskfile.yml b/Taskfile.yml index 8ede6852fa..160142e472 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -150,6 +150,8 @@ tasks: vars: ARCHS: sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}} + GO_ENV_VARS: + sh: echo "{{if eq "amd64" ARCH}}CC=\"zig cc -target x86_64-windows-gnu\"{{else}}CC=\"zig cc -target aarch64-windows-gnu\"{{end}}" build:server:linux: desc: Build the wavesrv component for Linux platforms (only generates artifacts for the current architecture). From a21f2d7cbb31e49c003b4b962ba5f16cae7aae1d Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 10 Jan 2025 14:42:37 -0800 Subject: [PATCH 3/5] add back beta flag --- .github/workflows/build-helper.yml | 2 +- BUILD.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-helper.yml b/.github/workflows/build-helper.yml index 75b36dd057..45764e5533 100644 --- a/.github/workflows/build-helper.yml +++ b/.github/workflows/build-helper.yml @@ -38,7 +38,7 @@ jobs: sudo apt-get update sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools sudo snap install snapcraft --classic - sudo snap install zig --classic # We use Zig instead of glibc for cgo compilation as it is more-easily statically linked + sudo snap install zig --classic --beta # We use Zig instead of glibc for cgo compilation as it is more-easily statically linked - name: Install Windows Build Dependencies (Windows only) if: matrix.platform == 'windows' run: | diff --git a/BUILD.md b/BUILD.md index 743a6b57ec..ded347dce3 100644 --- a/BUILD.md +++ b/BUILD.md @@ -20,7 +20,7 @@ Debian/Ubuntu: ```sh sudo apt install zip snapd -sudo snap install zig --classic +sudo snap install zig --classic --beta ``` Fedora/RHEL: From 84a11be9919b98a5868b3da175aa51cbe4e8111a Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 10 Jan 2025 14:46:12 -0800 Subject: [PATCH 4/5] try using setup-zig action --- .github/workflows/build-helper.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-helper.yml b/.github/workflows/build-helper.yml index 45764e5533..39ed2a770a 100644 --- a/.github/workflows/build-helper.yml +++ b/.github/workflows/build-helper.yml @@ -38,11 +38,9 @@ jobs: sudo apt-get update sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools sudo snap install snapcraft --classic - sudo snap install zig --classic --beta # We use Zig instead of glibc for cgo compilation as it is more-easily statically linked - - name: Install Windows Build Dependencies (Windows only) - if: matrix.platform == 'windows' - run: | - choco install -y zig + - name: Install Zig (not Mac) + if: matrix.platform != 'darwin' + uses: mlugg/setup-zig@v1 # 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) From 4b98662075dcebbd7fa69d050a68076a3b357e10 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 10 Jan 2025 14:55:52 -0800 Subject: [PATCH 5/5] Add Zig to testdriver build --- .github/workflows/testdriver-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/testdriver-build.yml b/.github/workflows/testdriver-build.yml index 793bd9c30c..028a9af688 100644 --- a/.github/workflows/testdriver-build.yml +++ b/.github/workflows/testdriver-build.yml @@ -57,6 +57,8 @@ jobs: with: version: 3.x repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Zig + uses: mlugg/setup-zig@v1 - name: Build run: task package