update 02.3 (#769)

This commit is contained in:
Lanffy
2020-06-11 22:45:04 +08:00
committed by GitHub
parent c2bd2009e9
commit cb2f9ec721
2 changed files with 29 additions and 0 deletions

View File

@@ -44,6 +44,35 @@
cd $GOROOT/src
./all.bash
**编译注意事项**
编译时如果出现如下报错:
![](images/2.3.allbasherror.png?raw=true)
可能是因为 `$GOROOT_BOOTSTRAP` 变量没有设置。这个目录在安装 Go 1.5 版本及之后的版本时需要设置。
由于在 1.4 版本后Go 编译器实现了自举,即通过 1.4 版本来编译安装之后版本的编译器。如果不设置该环境变量的话,会产生这样一个错误 `Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.`
设置 `$GOROOT_BOOTSTRAP` 变量:
export GOROOT_BOOTSTRAP=$HOME/go1.4
设置完成后,下载 1.4 版本的源码到该目录:
git clone https://github.com/golang/go.git $HOME/go1.4
git checkout -b release-branch.go1.4 origin/release-branch.go1.4
进入 1.4 的文件夹后,进行编译:
cd $HOME/go1.4/src
./make.bash
1.4 编译安装好之后,进入 `$GOROOT` 文件夹,真正开始编译安装 Go
cd $HOME/go/src
./all.bash
在完成编译之后(通常在 1 分钟以内,如果你在 B 型树莓派上编译,一般需要 1 个小时),你会在终端看到如下信息被打印:

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB