Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Cross-compile macOS binaries with the pure-Go SQLite driver

629df77e31a37ae5f986f4019271bb654c7c4bfc · Keenan Nemetz · 12d ago · parent 8cdf2f6b

Cross-compile macOS binaries with the pure-Go SQLite driver

The release published only Linux binaries, and the tree did not compile for
GOOS=darwin: syscall.Statfs_t.Bsize is uint32 there and int64 on Linux. Even
with that fixed, the cgo SQLite driver made a Darwin binary impossible to
produce on a Linux runner without an Apple SDK.

Return to modernc.org/sqlite, the pure-Go driver this project used before the
size change in #91. The DSN shorthand is unchanged because modernc accepts the
same _busy_timeout, _journal_mode, _foreign_keys and _txlock keys mattn does, so
the stores only change their driver name and blank import. With CGO_ENABLED=0
the tree cross-compiles for linux/amd64, linux/arm64, darwin/amd64 and
darwin/arm64 from the pinned release image, and the Linux binaries are static.

The release workflow now builds both Darwin binaries before the checksum step,
so SHA256SUMS covers them and the channel serves them; verify builds them on
every push so a platform mistake fails on the push instead of the tag.

This also fixes two defects in what we shipped:

- The packaged binary needed GLIBC_2.34 while nfpm.yaml declared only git and
  libsqlite3-0, so Debian 11 and Ubuntu 20.04 installed a package that failed at
  exec. A static binary has no libc floor.
- -tags sqlite_fts5 was inert under -tags libsqlite3, because the amalgamation
  it configures is not compiled, so full-text search depended on how the user's
  distribution built libsqlite3.so.0. The engine is now compiled in.

The cost is the size growth measured in #91, reversed deliberately: 19.3 MB with
system SQLite, 23.4 MB with the engine compiled in on linux/amd64. SQLite
security updates now arrive with a Vole release rather than with apt upgrade;
the SBOM names the engine version, which is what makes that triage possible.

Closes: 01M7ZFNCCJDTS2V5RTYQS9QQ84

.vole/images/release.yaml +5−9

@@ -12,20 +12,16 @@
12 12 version: 1
13 13 from: golang:1.27.4-bookworm@sha256:4fa7c968ba93f1635670522dbb01a2c78150443e1385746924566079f36570ea
14 14 env:
15 CGO_ENABLED: "1"
16 # Link the system SQLite instead of compiling the driver's bundled copy; the
17 # packages declare the matching runtime library (see packaging/nfpm.yaml).
18 GOFLAGS: "-tags=libsqlite3,sqlite_fts5"
15 # The SQLite driver is pure Go, so nothing here links a system library. Keeping
16 # cgo off makes the binaries static and lets both architectures, and macOS,
17 # cross-compile from this one amd64 image with no cross toolchain.
18 CGO_ENABLED: "0"
19 19 # Opt in to the runner's cache mount, so a tag build reuses what CI already
20 20 # downloaded and compiled.
21 21 GOMODCACHE: "/cache/go-mod"
22 22 GOCACHE: "/cache/go-build"
23 23 run:
24 # arm64 is built on this amd64 image with a cross compiler, so the arm64
25 # libraries have to be installable beside the amd64 ones. Debian's archive
26 # carries both, so adding the architecture is enough.
27 - dpkg --add-architecture arm64
28 - apt-get update && apt-get install -y --no-install-recommends git ca-certificates gcc python3 dpkg-dev createrepo-c pacman-package-manager makepkg libarchive-tools zstd rpm-common rpm gnupg libsqlite3-dev:amd64 gcc-aarch64-linux-gnu libsqlite3-dev:arm64 && rm -rf /var/lib/apt/lists/*
24 - apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 dpkg-dev createrepo-c pacman-package-manager makepkg libarchive-tools zstd rpm-common rpm gnupg && rm -rf /var/lib/apt/lists/*
29 25 # The test step spawns ssh and ssh-keygen, which call getpwuid() and exit 255
30 26 # with "No user exists for uid N" when the container runs as the host's uid and
31 27 # the image has no passwd entry for it. Same reason, same entry as the verify