https://github.com/crazy-max/xgo
Go CGO cross compiler
https://github.com/crazy-max/xgo
cgo cross-compiler docker golang
Last synced: about 1 month ago
JSON representation
Go CGO cross compiler
- Host: GitHub
- URL: https://github.com/crazy-max/xgo
- Owner: crazy-max
- License: mit
- Created: 2018-09-17T18:26:04.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2026-05-16T14:40:39.000Z (about 1 month ago)
- Last Synced: 2026-05-16T14:43:58.134Z (about 1 month ago)
- Topics: cgo, cross-compiler, docker, golang
- Language: Shell
- Homepage: https://hub.docker.com/r/crazymax/xgo/tags/?page=1&ordering=last_updated
- Size: 1.03 MB
- Stars: 224
- Watchers: 1
- Forks: 28
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/crazy-max/xgo/releases/latest)
[](https://github.com/crazy-max/xgo/releases/latest)
[](https://github.com/crazy-max/xgo/actions?query=workflow%3Aimage)
[](https://github.com/crazy-max/xgo/actions?query=workflow%3Atest)
[](https://hub.docker.com/r/crazymax/xgo/)
[](https://hub.docker.com/r/crazymax/xgo/)
[](https://goreportcard.com/report/github.com/crazy-max/xgo)
[](https://github.com/sponsors/crazy-max)
[](https://www.paypal.me/crazyws)
___
* [Fork](#fork)
* [Build](#Build)
* [Documentation](#documentation)
* [Contributing](#contributing)
* [Lisence](#license)
## Fork
This repository is a fork of [karalabe/xgo](https://github.com/karalabe/xgo) to
push images and tags to a single docker repository on several registries to make
things more consistent for users. It uses [`goxx` image](https://github.com/crazy-max/goxx)
as base that provides all the necessary Go tool-chains, C/C++ cross-compilers
and platform headers/libraries.
| Registry | Image |
|------------------------------------------------------------------------------------------------|-------------------------|
| [Docker Hub](https://hub.docker.com/r/crazymax/xgo/) | `crazymax/xgo` |
| [GitHub Container Registry](https://github.com/users/crazy-max/packages/container/package/xgo) | `ghcr.io/crazy-max/xgo` |
```
$ docker buildx imagetools inspect crazymax/xgo --format "{{json .Manifest}}" | \
jq -r '.manifests[] | select(.platform.os != null and .platform.os != "unknown") | .platform | "\(.os)/\(.architecture)\(if .variant then "/" + .variant else "" end)"'
linux/amd64
linux/arm64
```
This also creates a [standalone xgo executable](https://github.com/crazy-max/xgo/releases/latest)
that can be used on many platforms.
## Build
Build xgo yourself using Docker [`buildx bake`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md):
```shell
git clone https://github.com/crazy-max/xgo.git xgo
cd xgo
# Build xgo image and output to docker with xgo:local tag
docker buildx bake
# Tests
BASE_IMAGE=xgo:local docker buildx bake test-c
BASE_IMAGE=xgo:local docker buildx bake test-cpp
BASE_IMAGE=xgo:local docker buildx bake test-gorm
# Create xgo artifacts in ./dist
docker buildx bake artifact-all
```
## Documentation
* [About](doc/about.md)
* [Enter xgo](doc/enter-xgo.md)
* [Installation](doc/installation.md)
* [Usage](doc/usage.md)
* [Build flags](doc/usage/build-flags.md)
* [Go releases](doc/usage/go-releases.md)
* [Output prefixing](doc/usage/output-prefixing.md)
* [Branch selection](doc/usage/branch-selection.md)
* [Remote selection](doc/usage/remote-selection.md)
* [Package selection](doc/usage/package-selection.md)
* [Limit build targets](doc/usage/limit-build-targets.md)
* [Platform versions](doc/usage/platform-versions.md)
* [CGO dependencies](doc/usage/cgo-dependencies.md)
## Contributing
Want to contribute? Awesome! The most basic way to show your support is to star
the project, or to raise issues. You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
or by making a [PayPal donation](https://www.paypal.me/crazyws) to ensure this
journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
## License
MIT. See `LICENSE` for more details.