Skip to content

Cross-compiling Go with CGO

The best option to cross-compile Go project with CGO dependencies would be in using Docker image. This project provides the Docker images with a bunch of ready-to-use cross-compilers as well as how-to make a sysroot. All that wrapped into this example

If you have GoReleaser Pro, you can also use the split and merge feature to build for each platform natively and merge the builds later. Check this article for an example, and the documentation here.