安装go
可以参照我上一篇博客1
2
3
4
5
6
7
8wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
tar -xvf go1.10.3.linux-amd64.tar.gz
mv go /usr/local/
mkdir -p ~/go
vim /etc/profile
export GOPATH=~/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
source /etc/profile
安装依赖包
1 | apt-get update |
Fabric源码下载
1 | git clone https://github.com/hyperledger/fabric $GOPATH/src/github.com/hyperledger/fabric |
或1
2go get github.com/hyperledger/fabric
go get github.com/hyperledger/fabric-ca
编译fabric代码
1 | cd $GOPATH/src/github.com/hyperledger/fabric |
解决编译fabric过程中报错
1. 解决make docker时候报错golang-x-tool错误:
错误信息:
1 | package golang.org/x/tools/go/gcexportdata: unrecognized import path "golang.org/x/tools/go/gcexportdata" |
解决方案1
git clone https://github.com/golang/tools.git $GOPATH/src/golang.org/x/tool
2. 解决:cp: cannot stat ‘build/docker/gotools/bin/protoc-gen-go’: No such file or directory
1 | go get github.com/golang/protobuf/protoc-gen-go |
编译fabric-ca代码
1 | cd $GOPATH/src/github.com/hyperledger/fabric-ca |