From 41d8e61a6b9d8f9db912626eb2bbc535e929fefc Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 11 Dec 2020 13:32:14 -0500 Subject: [PATCH] doc: make clear that Go 1.4 is not required for bootstrap Go 1.4 does not work on some systems, including the most recent versions of macOS. Make it clearer that that's not the only way to bootstrap Go. Change-Id: I7c03d6808e43bf26283a53eab2bb0b2dc4af73af Reviewed-on: https://go-review.googlesource.com/c/go/+/277216 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- doc/install-source.html | 71 ++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/doc/install-source.html b/doc/install-source.html index c6dc3aed43e..f0a909263cf 100644 --- a/doc/install-source.html +++ b/doc/install-source.html @@ -119,11 +119,26 @@ The Go toolchain is written in Go. To build it, you need a Go compiler installed The scripts that do the initial build of the tools look for a "go" command in $PATH, so as long as you have Go installed in your system and configured in your $PATH, you are ready to build Go -from source. +from source. Or if you prefer you can set $GOROOT_BOOTSTRAP to the root of a Go installation to use to build the new Go toolchain; $GOROOT_BOOTSTRAP/bin/go should be the go command to use.

+

+There are four possible ways to obtain a bootstrap toolchain: +

+ +
    +
  • Download a recent binary release of Go. +
  • Cross-compile a toolchain using a system with a working Go installation. +
  • Use gccgo. +
  • Compile a toolchain from Go 1.4, the last Go release with a compiler written in C. +
+ +

+These approaches are detailed below. +

+

Bootstrap toolchain from binary release

@@ -132,30 +147,6 @@ To use a binary release as a bootstrap toolchain, see packaged Go distribution.

-

Bootstrap toolchain from source

- -

-To build a bootstrap toolchain from source, use -either the git branch release-branch.go1.4 or -go1.4-bootstrap-20171003.tar.gz, -which contains the Go 1.4 source code plus accumulated fixes -to keep the tools running on newer operating systems. -(Go 1.4 was the last distribution in which the toolchain was written in C.) -After unpacking the Go 1.4 source, cd to -the src subdirectory, set CGO_ENABLED=0 in -the environment, and run make.bash (or, -on Windows, make.bat). -

- -

-Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory, -you must keep this git clone instance checked out to branch -release-branch.go1.4. Specifically, do not attempt to reuse -this git clone in the later step named "Fetch the repository." The go1.4 -bootstrap toolchain must be able to properly traverse the go1.4 sources -that it assumes are present under this repository root. -

-

Bootstrap toolchain from cross-compiled source

@@ -194,6 +185,36 @@ $ sudo update-alternatives --set go /usr/bin/go-5 $ GOROOT_BOOTSTRAP=/usr ./make.bash +

Bootstrap toolchain from C source code

+ +

+To build a bootstrap toolchain from C source code, use +either the git branch release-branch.go1.4 or +go1.4-bootstrap-20171003.tar.gz, +which contains the Go 1.4 source code plus accumulated fixes +to keep the tools running on newer operating systems. +(Go 1.4 was the last distribution in which the toolchain was written in C.) +After unpacking the Go 1.4 source, cd to +the src subdirectory, set CGO_ENABLED=0 in +the environment, and run make.bash (or, +on Windows, make.bat). +

+ +

+Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory, +you must keep this git clone instance checked out to branch +release-branch.go1.4. Specifically, do not attempt to reuse +this git clone in the later step named "Fetch the repository." The go1.4 +bootstrap toolchain must be able to properly traverse the go1.4 sources +that it assumes are present under this repository root. +

+ +

+Note that Go 1.4 does not run on all systems that later versions of Go do. +In particular, Go 1.4 does not support current versions of macOS. +On such systems, the bootstrap toolchain must be obtained using one of the other methods. +

+

Install Git, if needed