Github messages for voidlinux
 help / color / Atom feed
Subject: Re: [PR PATCH] [Updated] go: add a binary bootstrap package (1.12 series for now) and switch the compiler to it from 1.4
Date: Mon, 11 Nov 2019 00:00:52 +0100
Message-ID: <20191110230052.imCYT2VA0KUoRpE4I3CxVi-NyBHaSA2JgwNPSxOavqg@z> (raw)
In-Reply-To: <>

[-- Attachment #1: Type: text/plain, Size: 2717 bytes --]

There is an updated pull request by q66 against master on the void-packages repository go-bootstrap

go: add a binary bootstrap package (1.12 series for now) and switch the compiler to it from 1.4
This adds a `go1.12-bootstrap` package newly used instead of `go1.4-bootstrap` to bootstrap the main Go compiler. The reason for this is to allow bootstrapping on platforms the ancient codebase does not support, particularly `ppc64le` and `aarch64`.

The new bootstrap package can technically run on all the targets that are in the intersection of what the official compiler supports and what Void supports.

~~There is a problem that the official binaries require glibc (just its dynamic linker, the libc itself and libpthread). In order to deal with that on musl, fetch a binary copy of glibc from Debian (which is reproducibly built, so it should be trustable) and patch the official binaries so that they use the newly bundled libc and dynamic linker. This allows the compiler to execute in a musl system, and build the proper target compiler (which will use the musl dynamic linker and libc, of course).~~

~~I chose the approach after evaluating all other choices, including `gcompat` and `gccgo`; in the end this was the only thing that truly and reliably worked.~~

I used gcompat to be able to run the compiler. In order for that to work, gcompat needs to be updated and patched, as in We still need to use patchelf to patch out the `lib64` requirement.

The second part of this patchset switches the `go` package to use the new 1.12 bootstrap. Since 1.12, `GOCACHE` must be not set when bootstrapping, so that line was removed. I also added new `broken` lines to disable the package on big endian PowerPC systems (ppc64 BE support uses incorrect ABI and requires POWER8 hardware, making it not safely distributable; 32-bit ppc was just never supported at all).

Additionally, I also added a `broken` when cross-building on the same architecture to a different libc (e.g. `x86_64` to `x86_64-musl`). This is because the build system does not account for this scenario and just does not cross build; this creates a package without failing but the contained compiler is just a compiler for the host system and will not function on the target. So at least until this problem is taken care of, disable it in order to not silently build broken packages.

If this is accepted, we can drop the `go1.4-bootstrap` package afterwards.

@the-maldridge @nilium 

A patch file from is attached

[-- Warning: decoded text below may be mangled --]
[-- Attachment #2: github-pr-go-bootstrap-16287.patch --]
[-- Type: text/x-diff, Size: 4770 bytes --]

From 64c7b2f28238ce5fd9e978eaee13912e8d9fe908 Mon Sep 17 00:00:00 2001
From: q66 <>
Date: Sun, 10 Mar 2019 21:53:45 +0100
Subject: [PATCH 1/2] New package: go1.12-bootstrap-1.12.13

 srcpkgs/go1.12-bootstrap/INSTALL.msg |  4 ++
 srcpkgs/go1.12-bootstrap/template    | 64 ++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 srcpkgs/go1.12-bootstrap/INSTALL.msg
 create mode 100644 srcpkgs/go1.12-bootstrap/template

diff --git a/srcpkgs/go1.12-bootstrap/INSTALL.msg b/srcpkgs/go1.12-bootstrap/INSTALL.msg
new file mode 100644
index 00000000000..142aeabbc1b
--- /dev/null
+++ b/srcpkgs/go1.12-bootstrap/INSTALL.msg
@@ -0,0 +1,4 @@
+This is a copy of the official Go language toolchain binaries as provided by
+the project on its download page. Please do keep in mind that it is almost
+definitely not what you want to use and exists purely for the purpose of
+bootstrapping the official compiler package (called simply 'go').
diff --git a/srcpkgs/go1.12-bootstrap/template b/srcpkgs/go1.12-bootstrap/template
new file mode 100644
index 00000000000..840fcf72b56
--- /dev/null
+++ b/srcpkgs/go1.12-bootstrap/template
@@ -0,0 +1,64 @@
+# Template file for 'go1.12-bootstrap'
+archs="x86_64* i686* armv[67]l* aarch64* ppc64le*"
+short_desc="Go 1.12 (bootstrap compiler)"
+maintainer="q66 <>"
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	depends+=" gcompat"
+	hostmakedepends+=" patchelf"
+	x86_64*)
+		_dist_arch="amd64"
+		checksum="da036454cb3353f9f507f0ceed4048feac611065e4e1818b434365eb32ac9bdc"
+		;;
+	i686*)
+		_dist_arch="386"
+		checksum="fafcb585591557b7b16d9b22dec4654193d205cf444b1810ab2988f658585e23"
+		;;
+	arm*)
+		_dist_arch="armv6l"
+		checksum="bf061cc3d4951e07904496b5c3d6c82419309d24634835522d786673a3f5438f"
+		;;
+	aarch64*)
+		_dist_arch="arm64"
+		checksum="dcfcb3785292c98f7a75c2276169dfe2d445c19f8ffe1d40b3f7b8f59712d361"
+		;;
+	ppc64le*)
+		_dist_arch="ppc64le"
+		checksum="77056264abcf5444ed0d9ab7552552ae2145ca8fb6c39d33db3c735eaf3f42d2"
+		;;
+post_build() {
+	[ "$XBPS_TARGET_LIBC" != "musl" ] && return 0
+	# we don't have lib64 compatibility path on musl 64-bit systems
+	# use patchelf to replace /lib64/<dynlinker> with /lib/<dynlinker>
+	local _interp=$(patchelf --print-interpreter ${wrksrc}/bin/go)
+	patchelf --set-interpreter ${_interp/lib64\//lib\/} ${wrksrc}/bin/go
+	patchelf --set-interpreter ${_interp/lib64\//lib\/} ${wrksrc}/bin/godoc
+do_install() {
+	vmkdir usr/lib/go1.12
+	vcopy bin usr/lib/go1.12
+	vcopy src usr/lib/go1.12
+	vcopy pkg usr/lib/go1.12
+	vlicense LICENSE

From 87e2b0a3ed04ed16d9d9d0ccfca445a7441aa42a Mon Sep 17 00:00:00 2001
From: q66 <>
Date: Sat, 15 Dec 2018 04:11:57 +0100
Subject: [PATCH 2/2] go: use go1.12-bootstrap, disable ppc* BE, disable

[ci skip]
 srcpkgs/go/template | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/go/template b/srcpkgs/go/template
index c263afc1d38..0349e5e3da2 100644
--- a/srcpkgs/go/template
+++ b/srcpkgs/go/template
@@ -4,14 +4,13 @@ version=1.13.4
 short_desc="Go Programming Language"
 maintainer="Michael Aldridge <>"
@@ -21,20 +20,27 @@ case "${XBPS_TARGET_MACHINE}" in
 	mips*) _goarch=mips ;;
 	i686*) _goarch=386 ;;
 	x86_64*) _goarch=amd64 ;;
+	ppc64le*) _goarch=ppc64le ;;
+	ppc64*) broken="Upstream does not support ELFv2 for big endian ppc64";;
+	ppc*) broken="Upstream does not support 32-bit ppc";;
 	*) _goarch=${XBPS_TARGET_MACHINE} ;;
+if [ "$CROSS_BUILD" ]; then
+	if [ "${XBPS_MACHINE%%-musl}" = "${XBPS_TARGET_MACHINE%%-musl}" ]; then
+		broken="Cross-compiling to different libc is not supported"
+	fi
 do_build() {
 	# FIXME: work around leaking go build-style vars when built as a
 	# dependency
-	export GOCACHE=off
+	export GOROOT_BOOTSTRAP="/usr/lib/go1.12"
 	export GOROOT=$PWD
 	export GOROOT_FINAL="/usr/lib/go"
-	export GOROOT_BOOTSTRAP="/usr/lib/go1.4"
 	export GOARCH=${_goarch}
 	cd "src"

  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-10  0:25 [PR PATCH] " voidlinux-github
2019-11-10  0:45 ` voidlinux-github
2019-11-10  1:58 ` voidlinux-github
2019-11-10 16:55 ` [PR PATCH] [Updated] " voidlinux-github
2019-11-10 16:57 ` voidlinux-github
2019-11-10 23:00 ` voidlinux-github [this message]
2019-11-11 18:33 ` [PR PATCH] [Updated] " voidlinux-github
2019-11-11 18:33 ` voidlinux-github
2019-11-11 19:34 ` voidlinux-github
2019-11-11 20:11 ` voidlinux-github

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191110230052.imCYT2VA0KUoRpE4I3CxVi-NyBHaSA2JgwNPSxOavqg@z \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Github messages for voidlinux

Archives are clonable: git clone --mirror

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone