#How do people handle Go CGO cross
1 messages · Page 1 of 1 (latest)
here's how I handle it today:
https://github.com/papercomputeco/tapes/blob/main/.dagger/build.go
TLDR: zig C toolchain for cross compiling Linux and using osxcross for cross compiling darwing C toolchain.
I supose this isn't even really a CGO / Go question: most on cross compiling toolchains in containers (which I also realize is an age old buildkit problem as well)
@proven phoenix Hey! I managed to cross compile a simple cgo app that uses mattn/go-sqlite3 by doing CC='zig cc'. Used latest zig 0.16.0, ran the go build on a linux amd64 machine using GOOS=darwin and GOARCH=arm64, and got an as-static-as-possible macos binary that ran fine on my mac.
👀 maybe I need to use 0.16 of the Zig toolchain. I was having problems with some macos headers not being set properly on 0.15.2