我第一次在自己的本本上安装golang,选择的版本是最新的1.9,本本系统是:MacOS high sierra(10.13),然后各种问题就出现了:
首先我进入1.9的源码src下执行all.bash,报错:
##### Building Go bootstrap tool.
cmd/dist
ERROR: Cannot find /Users/admin/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
发现是需要先安装1.4的版本后再安装更高的版本,进入1.4的src目录执行all.bash,编译后报错:
…………………………………………
cmd/go
failed MSpanList_Insert 0x460000 0x9dbff57ac7a 0x0
fatal error: MSpanList_Insert
runtime stack:
runtime.throw(0x3ed5eb)
/Users/admin/go/src/runtime/panic.go:491 +0xad fp=0x7ffeefbff560 sp=0x7ffeefbff530
runtime.MSpanList_Insert(0x40e368, 0x460000)
/Users/admin/go/src/runtime/mheap.c:692 +0x8f fp=0x7ffeefbff588 sp=0x7ffeefbff560
MHeap_FreeSpanLocked(0x40af60, 0x460000, 0x100)
………………………………………………
我又开始在谷歌上搜了半天,的确有很多这个错误的回答,说的是这个是macOS的系统引起的错误,在macOS 10.12以上的系统中,需要把$GOROOT_BOOTSTRAP指定成golang 1.7.1的版本,可是问题是我指定了$GOROOT_BOOTSTRAP为1.7.1,编译1.7的时候继续报了上面的错误:
##### Building Go bootstrap tool.
cmd/dist
ERROR: Cannot find /Users/admin/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
到了这里后,我感觉事情又回到了起点,我又继续搜了半天,实在无果,求大神帮帮忙,感激不尽!
<a href="/user/Willie" title="@Willie">@Willie</a>
```
git clone https://github.com/golang/go go1.4
cd go1.4
git checkout release-branch.go1.4
cd src
./all.bash
```
#9
更多评论