编译hyperledger fabric官方源码

开发环境介绍

  • UBUNTU 16.04 LTS
  • docker
  • docker-compose
  • git
  • go 1.8以上

进入fabric源码目录,

$GOPATH/src/github.com/hyperledger/fabric

编译,

make dist-clean all

我的环境报错,

cp: cannot stat 'build/docker/gotools/bin/protoc-gen-go': No such file or directory
Makefile:263: recipe for target 'build/image/ccenv/payload' failed
make: *** [build/image/ccenv/payload] Error 1

这个问题是因为fabric环境下找不到protoc-gen-go这个执行文件,解决方法是手动生成。


编译生成protoc-gen-go

root@pony-virtual-machine:~/gopath/src/github.com# gopm get -g -d github.com/golang/protobuf/protoc-gen-go

root@pony-virtual-machine:~/gopath/src/github.com/golang# go install github.com/golang/protobuf/protoc-gen-go

当然前提是你的环境支撑gopm命令。

到$GOPATH/bin目录下可以找到protoc-gen-go,把这个文件拷贝到刚才报错的目录

root@pony-virtual-machine:~/gopath/bin# cp protoc-gen-go /root/gopath/src/github.com/hyperledger/fabric/build/docker/gotools/bin/

这里分割点


再次编译。编译的时间有点久。最后编译报错, 原因我暂不清楚,不过不影响后面的操作。

the following files are missing SPDX-License-Identifier headers:
(standard input)

Please replace the Apache license header comment text with:
SPDX-License-Identifier: Apache-2.0
Makefile:111: recipe for target 'license' failed
make: *** [license] Error 1

在继续之前,还要安装gocov和gocov-xml,因为下面执行单元测试时会用到这两个执行文件。

安装 gocov

gopm get -g -d golang.org/x/tools/cover
gopm get -g -d github.com/axw/gocov/gocov
go install github.com/axw/gocov/gocov

安装 gocov-xml

gopm get -g -d github.com/AlekSi/gocov-xml
go install github.com/AlekSi/gocov-xml

然后拷贝到fabric目录下,

root@pony-virtual-machine:~/gopath/bin# cp gocov gocov-xml /root/gopath/src/github.com/hyperledger/fabric/build/docker/gotools/bin/

执行单元测试

make unit-test

过程就不贴了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值