Skip to content

Commit 47a4fec

Browse files
committed
refactor: Use native ARM64 runners instead of cross-compilation
- Use ubuntu-24.04-arm for Linux ARM64 builds - Remove cross-compiler setup (gcc-aarch64-linux-gnu) - Remove multiarch and PKG_CONFIG_PATH configuration - Simplify build step - no CC or GOOS/GOARCH overrides needed - Update Taskfile release:build to build for native platform only Benefits: - Simpler CI configuration - Faster builds (no cross-compilation overhead) - More reliable (native compilation avoids toolchain issues) - Each platform builds with its own native SQLite library This eliminates the linker errors when trying to cross-compile with dynamic SQLite linking.
1 parent 3589df1 commit 47a4fec

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

.github/workflows/artifacts.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
goos: linux
2222
goarch: amd64
2323
cgo: "1"
24-
- os: ubuntu-24.04
24+
- os: ubuntu-24.04-arm
2525
goos: linux
2626
goarch: arm64
2727
cgo: "1"
@@ -46,19 +46,12 @@ jobs:
4646
go-version-file: 'go.mod'
4747
cache: true
4848

49-
- name: Install build dependencies (Linux amd64)
50-
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
49+
- name: Install build dependencies (Linux)
50+
if: matrix.goos == 'linux'
5151
run: |
5252
sudo apt-get update
5353
sudo apt-get install -y gcc libsqlite3-dev
5454
55-
- name: Install build dependencies (Linux arm64)
56-
if: matrix.goos == 'linux' && matrix.goarch == 'arm64'
57-
run: |
58-
sudo dpkg --add-architecture arm64
59-
sudo apt-get update
60-
sudo apt-get install -y gcc-aarch64-linux-gnu libsqlite3-dev:arm64
61-
6255
- name: Get version info
6356
id: version
6457
run: |
@@ -72,10 +65,6 @@ jobs:
7265
- name: Build binary
7366
env:
7467
CGO_ENABLED: ${{ matrix.cgo }}
75-
GOOS: ${{ matrix.goos }}
76-
GOARCH: ${{ matrix.goarch }}
77-
CC: ${{ matrix.goarch == 'arm64' && matrix.goos == 'linux' && 'aarch64-linux-gnu-gcc' || '' }}
78-
PKG_CONFIG_PATH: ${{ matrix.goarch == 'arm64' && matrix.goos == 'linux' && '/usr/lib/aarch64-linux-gnu/pkgconfig' || '' }}
7968
run: |
8069
go build -tags libsqlite3 -ldflags "-w -s -X github.com/inference-gateway/cli/cmd.version=${{ steps.version.outputs.version }} -X github.com/inference-gateway/cli/cmd.commit=${{ steps.version.outputs.commit }} -X github.com/inference-gateway/cli/cmd.date=${{ steps.version.outputs.date }}" -o infer-${{ matrix.goos }}-${{ matrix.goarch }} .
8170

Taskfile.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,18 @@ tasks:
151151
- test
152152

153153
release:build:
154-
desc: Build release binaries for multiple platforms (Linux only - macOS builds require native runners)
154+
desc: Build release binary for current platform only (multi-platform builds use GitHub Actions with native runners)
155155
cmds:
156156
- mkdir -p dist
157-
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -tags libsqlite3 -ldflags "-w -s -X github.com/inference-gateway/cli/cmd.version={{.VERSION}} -X github.com/inference-gateway/cli/cmd.commit={{.COMMIT}} -X github.com/inference-gateway/cli/cmd.date={{.DATE}}" -o dist/{{.BINARY_NAME}}-linux-amd64 {{.MAIN_PACKAGE}}
158157
- |
159-
if command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then
160-
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -tags libsqlite3 -ldflags "-w -s -X github.com/inference-gateway/cli/cmd.version={{.VERSION}} -X github.com/inference-gateway/cli/cmd.commit={{.COMMIT}} -X github.com/inference-gateway/cli/cmd.date={{.DATE}}" -o dist/{{.BINARY_NAME}}-linux-arm64 {{.MAIN_PACKAGE}}
161-
else
162-
echo "⚠ ARM64 cross-compiler not found, skipping linux-arm64 build"
163-
echo " Install: gcc-aarch64-linux-gnu (or build on ARM64 machine)"
164-
fi
158+
echo "Building for native platform only..."
159+
GOOS=$(go env GOOS)
160+
GOARCH=$(go env GOARCH)
161+
CGO_ENABLED=1 go build -tags libsqlite3 -ldflags "-w -s -X github.com/inference-gateway/cli/cmd.version={{.VERSION}} -X github.com/inference-gateway/cli/cmd.commit={{.COMMIT}} -X github.com/inference-gateway/cli/cmd.date={{.DATE}}" -o dist/{{.BINARY_NAME}}-${GOOS}-${GOARCH} {{.MAIN_PACKAGE}}
162+
echo "✓ Built dist/{{.BINARY_NAME}}-${GOOS}-${GOARCH}"
163+
echo ""
164+
echo "Note: Cross-platform builds with dynamic SQLite linking require native runners."
165+
echo "Use GitHub Actions for multi-platform releases."
165166
- cd dist && sha256sum {{.BINARY_NAME}}-* > checksums.txt
166167
- |
167168
if command -v cosign >/dev/null 2>&1; then

0 commit comments

Comments
 (0)