Skip to content

Commit

Permalink
update 02.3 (unknwon#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanffy authored Jun 11, 2020
1 parent c2bd200 commit cb2f9ec
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions eBook/02.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 个小时),你会在终端看到如下信息被打印:

Expand Down
Binary file added eBook/images/2.3.allbasherror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cb2f9ec

Please sign in to comment.