1
我想从源代码构建Go的最新版本(主分支的提示)。错误构建从源代码编译器
官方Go文档(https://golang.org/doc/install/source)声明您应该下载Go 1.4二进制文件以构建更新的版本。但是应该可以从源代码构建所有的应用程序。
要做到这一点,我设置变量.bashrc
:
PATH="$HOME/go/bin:$PATH"
export GOPATH=$HOME
然后从源代码编译去1.4:
source ~/.bashrc
git clone https://go.googlesource.com/go
mkdir ~/go1.4
cd ~/go
git archive --format=tar go1.4.3 |tar -xv -C ~/go1.4
cd ~/go1.4/src
./make.bash
终于打造的最新版本:
cd ~/go/src/
GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash
我记得几个月前没有问题,但今天我得到这些错误建设去1。 4 make.bash
:
# cmd/pprof
.../go1.4/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
.../go1.4/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
...
有什么错在我的方法?
1.永远不要设置GOROOT。 2构建提示,例如'GOROOT_BOOTSTRAP =/path/to/go1.6/go/tool。/ make.bash' – Volker
另外,请勿将go1.4/bin放入PATH中。 – JimB
@Volker:好的我不使用GOROOT,但是GOROOT_BOOSTRAP应该指向一个现有的GO编译器。我更新了这个问题,但问题仍然存在。 – psadac