Github messages for voidlinux
 help / color / mirror / Atom feed
From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
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	[thread overview]
Message-ID: <20191110230052.imCYT2VA0KUoRpE4I3CxVi-NyBHaSA2JgwNPSxOavqg@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-16287@inbox.vuxu.org>

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

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

https://github.com/void-ppc/void-packages go-bootstrap
https://github.com/void-linux/void-packages/pull/16287

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 https://github.com/void-linux/void-packages/pull/16320. 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 https://github.com/void-linux/void-packages/pull/16287.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- 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 <daniel@octaforge.org>
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'
+pkgname=go1.12-bootstrap
+version=1.12.13
+revision=1
+archs="x86_64* i686* armv[67]l* aarch64* ppc64le*"
+wrksrc="go"
+short_desc="Go 1.12 (bootstrap compiler)"
+maintainer="q66 <daniel@octaforge.org>"
+license="BSD-3-Clause"
+homepage="https://golang.org"
+nostrip=yes
+noverifyrdeps=yes
+nocross=yes
+lib32disabled=yes
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	depends+=" gcompat"
+	hostmakedepends+=" patchelf"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	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"
+		;;
+esac
+
+distfiles="https://dl.google.com/go/go${version}.linux-${_dist_arch}.tar.gz"
+
+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 <daniel@octaforge.org>
Date: Sat, 15 Dec 2018 04:11:57 +0100
Subject: [PATCH 2/2] go: use go1.12-bootstrap, disable ppc* BE, disable
 cross-libc

[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
 revision=1
 create_wrksrc=yes
 build_wrksrc=go
-hostmakedepends="go1.4-bootstrap"
+hostmakedepends="go1.12-bootstrap"
 short_desc="Go Programming Language"
 maintainer="Michael Aldridge <maldridge@voidlinux.org>"
 license="BSD-3-Clause"
 homepage="http://golang.org/"
 distfiles="https://golang.org/dl/go${version}.src.tar.gz"
 checksum=95dbeab442ee2746b9acf0934c8e2fc26414a0565c008631b04addb8c02e7624
-
 nostrip=yes
 noverifyrdeps=yes
 
@@ -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} ;;
 esac
 
+if [ "$CROSS_BUILD" ]; then
+	if [ "${XBPS_MACHINE%%-musl}" = "${XBPS_TARGET_MACHINE%%-musl}" ]; then
+		broken="Cross-compiling to different libc is not supported"
+	fi
+fi
+
 do_build() {
 	unset GCC CC CXX LD CFLAGS
 	# FIXME: work around leaking go build-style vars when built as a
 	# dependency
 	unset CGO_CXXFLAGS CGO_CFLAGS CGO_ENABLED
 
-
-	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	other threads:[~2019-11-10 23:00 UTC|newest]

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 publicly 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* 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 \
    --to=voidlinux-github@inbox.vuxu.org \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).