Mandatory plug of this article[0] describing how to use the Zig language toolchain to get easy cross-compilation with CGO.
It's really cool because cross-compilation is, imo, the most painful part of CGO - right after being incompatible with the whole runtime model, being blocking, and being hard to profile with Go profiling tools.
Compile in Debian.
It has a full cross compile tool chain and is as simple as adding the target architecture to dpkg to get the libraries you need (assuming you don't mind the versions packaged for Debian).
Getting the right libs is really the hardest part of cross compiling, and zig can't really help there.
Not to crap on zig, it's pretty badass, just offering a well battle tested alternative.
Wow this is awesome, thanks! I'm working on a Go project that uses sqlite right now, and I thought I was going to have to use xgo[1], which is cool and all, but it's like an 8 GB docker container, and I'd still be worried about glibc issues.
The default go sqlite driver is https://github.com/mattn/go-sqlite3, which is quite lovely, but I ran into issues with concurrency on read only databases.
I'm now using https://github.com/crawshaw/sqlite and it seems to address those issues (but I haven't gotten around to setting up a proper test to confirm). It may be worth perusing if you do run into performance problems. It does come with the caveat of not being a database/sql driver though.
It's really cool because cross-compilation is, imo, the most painful part of CGO - right after being incompatible with the whole runtime model, being blocking, and being hard to profile with Go profiling tools.
[0]: https://dev.to/kristoff/zig-makes-go-cross-compilation-just-...
Disclaimer: Not affiliated with the author in any way.