5 ms·
This is interesting and very timely for me. Just this week I was building a small Go system that uses SQLite. I needed to cross-compile it for FreeBSD on a Mac
by Kimitri 1y ago
This is interesting and very timely for me. Just this week I was building a small Go system that uses SQLite. I needed to cross-compile it for FreeBSD on a Mac and ran into issues with CGO. The easiest fix seemed to be to switch from a CGO based library to a pure Go one.
- algo_lover 1y agoI hit the same issue, building on mac to deploy to linux. I added this build step before `scp`ing the binary to the server docker run --rm --platform=linux/amd64 \ -v "$PWD":/app -w /app \ golang:1.22-bullseye \ /bin/bash -c "apt update && apt install -y gcc sqlite3 libsqlite3-dev && \ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o app-linux-amd64 ./cmd/main.go" Looking at the article, I should give modernc sqlite driver a try.
- slyzmud 1y agoI don't know for freebsd but at least for Linux I started using the zig toolchain and it's wonderful. https://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic https://zig.news/kristoff/building-sqlite-with-cgo-for-every...