Skip to content

How to compile Go app with sqlite3 for ARM on Mac

Published: at 06:00 PM

Scene

Prerequisites

Steps

  1. Install musl-cross
brew install FiloSottile/musl-cross/musl-cross --without-x86_64 --with-aarch64
  1. Compile your app
CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++ GOARCH=arm64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-linkmode external -extldflags -static" -o lserver --tags "fts5" .