{"id":15151854,"url":"https://github.com/elastic/golang-crossbuild","last_synced_at":"2025-04-13T00:44:02.459Z","repository":{"id":33967461,"uuid":"136536060","full_name":"elastic/golang-crossbuild","owner":"elastic","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-10T14:52:59.000Z","size":750,"stargazers_count":178,"open_issues_count":20,"forks_count":33,"subscribers_count":183,"default_branch":"main","last_synced_at":"2025-04-13T00:43:52.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elastic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-07T22:03:49.000Z","updated_at":"2025-04-11T19:59:22.000Z","dependencies_parsed_at":"2023-02-14T15:30:39.780Z","dependency_job_id":"88412797-af48-482f-8a65-4ad548d17c28","html_url":"https://github.com/elastic/golang-crossbuild","commit_stats":{"total_commits":269,"total_committers":24,"mean_commits":"11.208333333333334","dds":0.6877323420074349,"last_synced_commit":"ece4a5a9405975712dd2df2ee2e18e11c6c728f2"},"previous_names":[],"tags_count":108,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fgolang-crossbuild","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fgolang-crossbuild/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fgolang-crossbuild/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fgolang-crossbuild/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elastic","download_url":"https://codeload.github.com/elastic/golang-crossbuild/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650419,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T15:23:08.347Z","updated_at":"2025-04-13T00:44:02.449Z","avatar_url":"https://github.com/elastic.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"|                   | main | 1.23 |\n|-------------------|------|-|\n| golang-crossbuild |[![Build status](https://badge.buildkite.com/a62e956ff483d20043847488a8797382db305653ea9fac86b2.svg?branch=main)](https://buildkite.com/elastic/golang-crossbuild/builds?branch=main)|[![Build status](https://badge.buildkite.com/a62e956ff483d20043847488a8797382db305653ea9fac86b2.svg?branch=1.23)](https://buildkite.com/elastic/golang-crossbuild/builds?branch=1.23)|\n| llvm-apple        |[![Build status](https://badge.buildkite.com/608fe26d86b5da77dad646eec77944c306e5ad3a427c88dcf5.svg?branch=main)](https://buildkite.com/elastic/llvm-apple/builds?branch=main)|[![Build status](https://badge.buildkite.com/608fe26d86b5da77dad646eec77944c306e5ad3a427c88dcf5.svg?branch=1.23)](https://buildkite.com/elastic/llvm-apple/builds?branch=1.23)|\n| fpm               |[![Build status](https://badge.buildkite.com/86216c62729e32e235059e42d58bfb54901c20bf3394c704f3.svg?branch=main)](https://buildkite.com/elastic/fpm/builds?branch=main)|[![Build status](https://badge.buildkite.com/86216c62729e32e235059e42d58bfb54901c20bf3394c704f3.svg?branch=1.23)](https://buildkite.com/elastic/fpm/builds?branch=1.23)|\n\n\n# golang-crossbuild Docker images\n\nThis repository contains Dockerfiles for cross building Go binaries for various platforms.\nThe aim is to provide a simple way to build Go binaries for multiple platforms without having to install and configure cross compilers on your host machine.\nTo do that the project provides a set of Docker images that can be used to build Go binaries for the following platforms:\n\n* linux/amd64\n* linux/arm\n* linux/armel\n* linux/armhf\n* linux/arm64\n* linux/mips\n* linux/mipsle\n* linux/mips64\n* linux/ppc64\n* linux/ppc64le\n* linux/s390x\n* windows/amd64\n* darwin/amd64\n* darwin/arm64\n\nThe Docker images are based on Debian and the cross compilers are installed using the crossbuild-essential package.\nEach architecture has its own folder with the files needed to build the Docker image for that architecture.\nEach architecture has its own Dockerfile to build a Docker image for that architecture.\nEach architecture Dockerfile installs the crossbuild-essential package for that architecture and the libraries needed to build our binaries.\nThese Dockerfiles are generated files from `Dockerfile.tmpl` template file that is in the architectures folder.\nThis template is processed using a Makefile that is in the architectures folder.\nEach architecture folder has a `roofs` folder that contains the files that will be copied to the Docker image in the root folder.\nIn `rootfs` we have the `compolers.yml` file that contains the list of compilers that will be installed in the Docker image.\nEach Docker image has a basic compilation test that is executed when the image is built. This test uses `rootfs/helloworld.c` file to compile a simple C program and verify the architecture of the result binary.\nThe compiler used to build the binaries is LLVM.\nSome of the Docker images are build for the amd64 and arm64 architectures, this allow to run the Docker images in linux/amd64, linux/arm64, darwin/amd64, and darwin/arm64. This is done using the `.buildkite/scripts/buildx.sh` command.\n\nThe Docker images are tagged using the following format:\n\n* `docker.elastic.co/beats-dev/golang-crossbuild:\u003cgo-version\u003e-\u003carch\u003e-\u003cdebian-version\u003e`\n\nFor the latest version of the images based on the latest Debian and Go versions, the following tag is also used:\n\n* `docker.elastic.co/beats-dev/golang-crossbuild:\u003cgo-version\u003e-\u003carch\u003e`\n\n## Build tags\n\nThe tags match with the Golang version, and for each supported version there is a release in https://github.com/elastic/golang-crossbuild/releases.\n\nReplace `\u003cGOLANG_VERSION\u003e` with the version you would like to use, for instance: `1.17.1`\n\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-arm` - linux/arm64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-armel` - linux/armv5, linux/armv6\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-armhf` - linux/armv7\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-base`\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-darwin` - darwin/amd64 (MacOS 10.11, MacOS 10.14)\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main-debian7` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main-debian8` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main-debian9` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main-debian10` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main-debian11` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-main-debian12` - linux/i386, linux/amd64, windows/amd64\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-mips-debian11` - linux/mips64, linux/mips64el\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-mips-debian12` - linux/mips64, linux/mips64el\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-mips32` - linux/mips, linux/mipsle **NOTE**: it does not exist from Golang versions \u003e `1.18.5`/`1.17.12`.\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-ppc-debian12` - linux/ppc64, linux/ppc64le\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-s390x-debian11` - linux/s390x\n- `docker.elastic.co/beats-dev/golang-crossbuild:\u003cGOLANG_VERSION\u003e-s390x-debian12` - linux/s390x\n\n### glibc\n\n* **Debian7** uses `glibc 2.13` so the resulting binaries (if dynamically linked) have greater compatibility.\n* **Debian8** uses `glibc 2.19`.\n* **Debian9** uses `glibc 2.24`.\n* **Debian10** uses `glibc 2.28`.\n* **Debian11** uses `glibc 2.31`.\n\n## Old Build Tags\n\nUntil Golang version 1.15\n\n| Description | Tags for 1.10 | Tags for 1.11 | Tags for 1.12 | Tags for 1.13 | Tags for 1.14 | Tags for 1.15 |\n| ------------- | -----| ------- | ----- |  ------ |  ------ |  ------ |\n| linux/{amd64,386} and windows/{amd64,386} | `1.10.8-main` | `1.11.13-main` | `1.12.12-main` |  `1.13.12-main` | `1.14.15-main` | `1.15.14-main` |\n| linux/{armv5,armv6,armv7} | `1.10.8-arm` | `1.11.13-arm` | `1.12.12-arm` | `1.13.12-arm` | `1.14.15-arm` | `1.15.14-arm` |\n| linux/arm64 | **See above** | **See above** | **See above** | **See above** | **See above** | **See above** |\n| linux/{armv5,armv6} | **See above** | **See above** | **See above** | **See above** | **See above** | **See above** |\n| linux/{armv7} | **See above** | **See above** | **See above** | **See above** | **See above** | **See above** |\n| darwin/{386} | `1.10.8-darwin` | `1.11.13-darwin` | `1.12.12-darwin` | `1.13.12-darwin` | `1.14.15-darwin` | `1.15.14-darwin` |\n| darwin/{amd64} | `1.10.8-darwin` | `1.11.13-darwin` | `1.12.12-darwin` | `1.13.12-darwin` | `1.14.15-darwin` | `1.15.14-darwin` |\n| linux/{ppc64,ppc64le} | `1.10.8-ppc` | `1.11.13-ppc` | `1.12.12-ppc` | `1.13.12-ppc` | `1.14.15-ppc` | `1.15.14-ppc` |\n| linux/{mips,mipsle,mips64,mips64le} | `1.10.8-mips` | `1.11.13-mips` | `1.12.12-mips` | `1.13.12-mips` | `1.14.15-mips` |\n| linux/{mips64,mips64le} | **See above** | **See above** | **See above** | **See above** | **See above** | **See above** |\n| linux/{mips,mipsle} | **See above** | **See above** | **See above** | **See above** | **See above** | **See above** |\n| linux/s390x | `1.10.8-s390x` | `1.11.13-s390x` | `1.12.12-s390` | `1.13.12-s390` | `1.14.15-s390` | `1.15.14-s390` |\n| linux/{amd64,386} and windows/{amd64,386} (Debian 7 (see **below**)) |`1.10.8-main-debian7` | `1.11.13-main-debian7` | `1.12.12-main-debian7` | `1.13.12-main-debian7` | `1.14.15-main-debian7` | `1.15.14-main-debian7` |\n| linux/{amd64,386} and windows/{amd64,386} (Debian 8 (see **below**)) | `1.10.8-main-debian8` | `1.11.13-main-debian8` | `1.12.12-main-debian8` | `1.13.12-debian8` | `1.14.15-main-debian8` | `1.15.14-main-debian8` |\n| linux/{amd64,386} and windows/{amd64,386} (Debian 9 (see **below**)) | NA | NA | NA | NA | NA | `1.15.14-main-debian9` |\n| linux/{amd64,386} and windows/{amd64,386} (Debian 10 (see **below**)) | NA | NA | NA | NA | NA | `1.15.14-main-debian10` |\n| linux/arm64 (Debian 9 (see **below**)) | NA | NA | NA | NA | NA | `1.15.14-base-arm-debian9` |\n\n### glibc\n\n* **Debian7** uses `glibc 2.13` so the resulting binaries (if dynamically linked) have greater compatibility.\n* **Debian8** uses `glibc 2.19`.\n* **Debian9** uses `glibc 2.24`.\n* **Debian10** uses `glibc 2.28`.\n\n## Makefiles\n\nThere are several Makefiles in the profect across the different folders.\nThe Makefile in the root folder is used to build the Docker images for the different architectures,\nit triggers the build of all Docker images for all architectures and Debian versions supported.\n\nThe file `go/Makefile.common` is the default Makefile used to build the Docker images for the different architectures.\nThere is additional Makefile for each Debian version that is used to build the Docker images for that Debian version.\n\n* `go/Makefile.debian9`\n* `go/Makefile.debian10`\n* `go/Makefile.debian11`\n\nNo all architectures are supported in all Debian versions, so the Makefile for each Debian version will only build the Docker images for the architectures that are supported in that Debian version.\n\nOn the Makefiles there are some variables to define the name of the Docker image, the version of the Docker image, the Debian version, and the suffix to use in the tag of the Docker image.\n\n```make\nNAME           := golang-crossbuild\nVERSION        := 1.20.2\nDEBIAN_VERSION ?= 9\nSUFFIX         := -$(shell basename $(CURDIR))\nTAG_EXTENSION  ?=\n\nexport DEBIAN_VERSION TAG_EXTENSION\n\nDOCKER_CMD := docker build\n```\n\nIn this example the name of the Docker image is `golang-crossbuild`, the go version is `1.20.2` that is uses as part of the tag, the Debian version is `9`, the suffix is `-debian9`, and the tag extension is empty. Also the `DOCKER_CMD` variable is used to define the command to use to build the Docker image, in this case `docker build`.\n\nThe tag is build using the following format:\n\n```make\nTAG := $(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)\n```\n\nThe common variables to all the Makefiles are defined at `Makefile.common` file.\n\nTo more information about the supported architextures and the correlation with comercial names,\nyou can check the [Debian Supported Architectures](https://wiki.debian.org/SupportedArchitectures) page.\n\nTo make and push the Docker images for all the architectures and default Debian version, you can run the following command:\n\n```shell\nmake build push\n```\n\nTo make and push the Docker images for all the architectures and Debian 10, you can run the following command:\n\n```shell\nmake -C go -f Makefile.debian10 build push\n```\n\nFinally, to build a single Docker image for `arm` architecture and Debian 10, you can run the following command:\n\n```shell\nmake -C go -f Makefile.debian10 build push IMAGES=arm\n```\n\n## Multiarch Docker images\n\nSome of the Docker images are built for the amd64 and arm64 architectures, this allow to run the Docker images in linux/amd64, linux/arm64, darwin/amd64, and darwin/arm64. This is done using the `.buildkite/scripts/buildx.sh` command.\nTo choose if build a Docker image for amd64 and arm64 or only for amd64, The Makefiles check fot the value o `BUILDX` and `DOCKER_MULTIARCH` variables. In the target Makefile the `DOCKER_COMMAND` is replaced with the `.buildkite/scripts/buildx.sh` command.\n\n```make\nifeq ($(DOCKER_MULTIARCH),1)\nDOCKER_CMD := $(SELF_DIR)/../.buildkite/scripts/buildx.sh\nendif\n```\n\n## Docker images dependencies\n\nThe Docker images depends on each other, so there is an order to build them.\nThe are two Docker images that are parent of all the other images, the `fpm` and the `go/llvm-apple`.\nAnytime a new Debian version is released, the `fpm` and `go/llvm-apple` image needs to be updated to use the new Debian version.\nThe following diagram shows the dependencies between the Docker images.\n\n```mermaid\nstateDiagram-v2\n    [*] --\u003e Debian\n    Debian --\u003e fpm\n    Debian --\u003e base\n    Debian --\u003e base_arm\n    Debian --\u003e llvm_apple\n    llvm_apple --\u003e darwing_arm64\n    base --\u003e arm\n    base --\u003e armel\n    base --\u003e armhf\n    base --\u003e main\n    base --\u003e darwin\n    base --\u003e darwing_arm64\n    base --\u003e mips\n    base --\u003e mips32\n    base --\u003e npcap\n    base --\u003e ppc\n    base --\u003e s390x\n```\n\n## Releasing images for a new Go version\n\nWith every new version of `go` we made a new branch with the name of the previous version to allow us to continue building the Docker images for the previous version of `go`. So if we are in go `1.21` and go `1.22` is released, we create a new branch `1.21`, then we update the `main` branch to install go `1.22` as explained in the below steps:\n\n1. Update the Go version in [.go-version](https://github.com/elastic/golang-crossbuild/blob/main/.go-version).\n1. Update the Docker tag in\n   [Makefile.common](https://github.com/elastic/golang-crossbuild/blob/main/go/Makefile.common#L5).\n1. Run `.github/updatecli.d/bump-go-release-version.sh \"$(cat .go-version)\"`\n1. Update the versions listed in this README.md.\n1. Update the `go-minor` value in [bump-golang.yml](https://github.com/elastic/golang-crossbuild/blob/main/github/workflows/bump-golang.yml) with the new minor go version, i.e: `1.22`.\n1. Update the `go-minor` and `branch` values in [bump-golang-previous.yml](https://github.com/elastic/golang-crossbuild/blob/main/github/workflows/bump-golang-previous.yml) with the old minor go version, i.e: `1.21`.\n1. Add an entry in the `.mergify.yml` file to support the label backport for `backport-v1.x-1`, i.e: `backport-v1.21`.\n1. Create the GitHub label backport for `backport-v1.x-1` in https://github.com/elastic/golang-crossbuild/labels, i.e: `backport-v1.21`.\n1. Commit the changes. `git add -u \u0026\u0026 git commit -m 'Update to Go 1.x.y'`.\n1. Create a Pull Request with the description `'Update to Go 1.x.y'`.\n1. When merging the PR, the automation will release those docker images.\n\n**NOTE**: Due to the changes in the Debian packages repositories, there are no guarantees that the Docker images for the previous version of `go` will continue to work after some time.\n\n## FIPS Build\n\n[Makefile.common](./go/Makefile.common) has an env var that can be used to create a FIPS compliant golang-crossbuild image:\n```make\nFIPS           ?=\n```\n\nWhen this var is set to `\"true\"` the [microsoft/go](https://github.com/microsoft/go) will be used instead of the regular upstream go release.\nAdditionally the docker image will have the env vars `CGO_ENABLED=1` and `GOEXPERIMENT=systemcrypto` set to ensure binaries built within the crossbuild image are FIPS compliant by default.\n\n## Packaging MacOS SDK\n\nThe osxcross repository used to cross compile for MacOSX has [instructions for packaging the SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk).\n\nThe instructions for packaging the SDK on a Linux instance are:\n\n1. Clone the [osxcross](https://github.com/tpoechtrager/osxcross) repo.\n1. Install `clang`, `make`, `libssl-dev`, `lzma-dev`, `libxml2-dev`, `libbz2-dev`.\n1. Download [Xcode from Apple](Download Xcode: https://developer.apple.com/download/more]).\n1. Run `./tools/gen_sdk_package_pbzx.sh \u003cxcode\u003e.xip`.\n\n## Usage Example\n\n```shell\ndocker run -it --rm \\\n  -v $GOPATH/src/github.com/user/go-project:/go/src/github.com/user/go-project \\\n  -w /go/src/github.com/user/go-project \\\n  -e CGO_ENABLED=1 \\\n  docker.elastic.co/beats-dev/golang-crossbuild:1.16.7-armhf \\\n  --build-cmd \"make build\" \\\n  -p \"linux/armv7\"\n```\n\nThis will execute your projects `make build` target. While executing the build\ncommand the following variables with be added to the environment: GOOS, GOARCH,\nGOARM, PLATFORM_ID, CC, and CXX.\n\n## fpm Docker image\n\nThis Docker image install the [fpm](https://github.com/jordansissel/fpm) tool that is used to build packages.\n\n## go/llvm-apple Docker image\n\nThe LLVM compiler present in Debian does not support arm64e architecture, so we need to build our own LLVM compiler to support this architecture.\nThe llvm-apple Docker image is based on [Apple LLVM fork](https://github.com/apple/llvm-project) and [osxcross](https://codeload.github.com/tpoechtrager/osxcross). The image build the LLVM compiler and configure the image to be able to cross compile for MacOSX.\n\nLLVM need a SDK for macOS, the MacOSX-SDK used in the Docker image must be genarated from a MacOSX machine.\nFor the instructions to package the MacOS SDK see the [Packaging MacOS SDK](#packaging-macos-sdk) section.\n\n## go/base Docker image\n\nThis Docker image is the base image for all the other Docker images, it contains the base packages fro cross compilation.\nIt is build for amd64 and arm64 architectures for Debian 9+.\nIn the folder you can find the `sources.list` file that contains the list of repositories to use to install the packages,\nthis file is different for each Debian version. In some cases, this file must point to `http://archive.debian.org/debian` instead of `http://deb.debian.org/debian` to be able to install the packages, this happens when the Debian version reach the end of life.\n\nThe base image is the one that install the `go` compiler, and the build tools for the rest of Docker images.\nWhen a new version of go is released, the aDockerimage.tmpla files must be updated to install the new version.\n\n## go/base-arm Docker image\n\nThe `base-arm` image is the base image to crossbuild `linux/arm64` binaries on `arm` hosts, it is build for Debian 7+.\nThis image is user to crosscompile in `linux/arm`.\nIt was replaced by the `base` image for Debian 9+ when we started to build multiarchitecture Docker images.\nIt could be removed in the future, it allow to `crosscompile` arm binaries in `linux/arm64` machines, that it is not needed because the native architecture is the same than the target architecture.\nIt was added to golang-crossbuild due limitations of the build system.\n\n## go/main Docker image\n\nThe `main` image is the base image for the `amd64` architecture, it is build for Debian 7+.\nIt is used to cross compile for `linux/amd`, `linux/amd64`, `win/amd`, and `win/amd64`.\nThis Docker immage add two libraries to the `base` image, `libpcap` and `WpdPack` to be able to capture network packages on diferent OS.\nThes two libraries are precompiled and stored at https://storage.googleapis.com/ingest-buildkite-ci/sdks.\n\n## go/darwin Docker image\n\nThe `darwin` image is the base image for the MacOSX cross compilation, it is build for Debian 8+.\nIt can compiles for `darwin/amd` (Debian 10+), `darwin/amd64`, `darwin/arm64`, `darwin/arm64e`, and universal binaries.\nThis Docker image is based on the `base` image.\nIt uses [osxcross](https://codeload.github.com/tpoechtrager/osxcross) to configure the crosscompile for MacOSX.\nThis image require a MacOSX SDK to be installed in the Docker image,\nfor the instructions to package the MacOS SDK see the [Packaging MacOS SDK](#packaging-macos-sdk) section.\n\n## go/darwin-arm64 Docker image\n\nThe `darwin-arm64` image is the base image for the MacOSX cross compilation, it is build for Debian 10+.\nIt can compiles for `darwin/amd64`, `darwin/arm64`, and `darwin/arm64e`, and universal binaries.\nThis Docker image is based on the `base` image.\nIt uses the `llvm-apple` image to cross compile for MacOSX.\nThe `darwin-arm64` can replace the `darwin` image in the future, it is faster to build and it does not need to build [osxcross](https://codeload.github.com/tpoechtrager/osxcross) and uses the official LLVM fork from Apple so it support enhacement for `darwin` architectures.\n\n## go/arm Docker image\n\nThe `arm` image is the base image for the `arm64` architecture, it is build for Debian 9+.\nIt is used to cross compile for `linux/arm64`. This Docker image is based on the `base` image.\n\n## go/armel Docker image\n\nThe `armel` image is the base image for the `armel` architecture, it is build for Debian 12+.\nIt is used to cross compile for `linux/armel`. This Docker image is based on the `base` image.\n\n## go/armhf Docker image\n\nThe `armhf` image is the base image for the `armhf` architecture, it is build for Debian 9+.\nIt is used to cross compile for `linux/armhf`. This Docker image is based on the `base` image.\n\n## go/mips Docker image\n\nThe `mips` image is the base image for the `mips` architecture, it is build for Debian 12+.\nIt is used to cross compile for `linux/mips`. This Docker image is based on the `base` image.\n\n## go/mips32 Docker image\n\nThe `mips32` image is the base image for the `mips32` architecture, it is build for Debian 11+.\nIt is used to cross compile for `linux/mips32`. This Docker image is based on the `base` image.\n\n## go/ppc Docker image\n\nThe `ppc` image is the base image for the `ppc` architecture, it is build for Debian 12+.\nIt is used to cross compile for `linux/ppc`. This Docker image is based on the `base` image.\n\n## go/s390x Docker image\n\nThe `s390x` image is the base image for the `s390x` architecture, it is build for Debian 12+.\nIt is used to cross compile for `linux/s390x`. This Docker image is based on the `base` image.\n\n## go/npcap Docker image\n\nThe `npcap` image is a placeholder for the `npcap` library, see [npcap](./NPCAP.md) for more information.\n\n## Troubleshooting\n\n### bzip2 issues\n\nIf the `gen_sdk_package_pbza.sh` script gives an error that reads:\n\n```shell\nError while extracting archive:(Metadata): bzip2 support not compiled in. (Success)\n```\n\nA manual work-around is needed in order to create the SDK (other people have reported that installing `libbz2-dev` fixed this issue).\n\nFirst edit `osxcross/tools/tools.sh` to remove the `trap` line from the `create_tmp_dir` function (currently line 264).\n\nThen re-run  `./tools/gen_sdk_package_pbzx.sh \u003cxcode\u003e.xip`.\n\nGo to the tmp dir created in the build dir: `cd osxcross/build/tmp_\u003cX\u003e`.\n\nThen run:\n\n```shell\n../../target/SDK/tools/bin/pbzx -n Content | cpio -i\ncd ../..\nXCODEDIR=osxcross/build/tmp_\u003cX\u003e ./tools/gen_sdk_package.sh\n```\n\nThe SDK should be in the working directory.\nThe tmp dir can be safely deleted after this.\n\nThe SDKs should be uploaded into the `gs://ingest-buildkite-ci/sdks` bucket on GCP (Google Cloud Platform).\nThis is accessible to authorized users in the `platform-ingest` project [here](https://console.cloud.google.com/storage/browser/ingest-buildkite-ci/sdks).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fgolang-crossbuild","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felastic%2Fgolang-crossbuild","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fgolang-crossbuild/lists"}