mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 19:41:43 +08:00
update 02.3 (#769)
This commit is contained in:
@@ -44,6 +44,35 @@
|
|||||||
|
|
||||||
cd $GOROOT/src
|
cd $GOROOT/src
|
||||||
./all.bash
|
./all.bash
|
||||||
|
|
||||||
|
**编译注意事项**
|
||||||
|
|
||||||
|
编译时如果出现如下报错:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
可能是因为 `$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 个小时),你会在终端看到如下信息被打印:
|
在完成编译之后(通常在 1 分钟以内,如果你在 B 型树莓派上编译,一般需要 1 个小时),你会在终端看到如下信息被打印:
|
||||||
|
|
||||||
|
BIN
eBook/images/2.3.allbasherror.png
Normal file
BIN
eBook/images/2.3.allbasherror.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Reference in New Issue
Block a user