Hyperledger-Fabric开发环境准备

安装homebrew

查看清华大学开源软件镜像站配置国内镜像加快安装软件的速度。

安装Fabric的环境依赖

使用brew安装gitgojqsofthsmdocker:

1
2
brew install git go jq softhsm
brew cask install --appdir="/Applications" docker

我在安装的时候因为Great Wall的原因有个go的工具没有下载下来,记录一下

1
2
3
Failure while executing; `git clone --branch release-branch.go1.15 -c advice.detachedHead=false https://go.googlesource.com/tools.git /Users/apple/Library/Caches/Homebrew/go--gotools--git` exited with 128. Here's the output:
Cloning into '/Users/apple/Library/Caches/Homebrew/go--gotools--git'...
fatal: unable to access 'https://go.googlesource.com/tools.git/': Failed to connect to go.googlesource.com port 443: Operation timed out

fabric源码下载

为了加速,在gitee上导入项目:https://github.com/hyperledger/fabric然后clone到本地。

安装开发工具

1、在fabric目录下,运行命令:

1
make gotools

2、安装完成工具之后,验证环境是否正常

1
2
make basic-checks integration-test-prereqs
ginkgo -r ./integration/nwo

我的第二部测试没有通过,记录如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(base) apple@WHOAMIdeMacBook-Pro:~/code/open-source/blockchain/hyperledger/fabric$     ginkgo -r ./integration/nwo
Running Suite: New World Order Suite
====================================
Random Seed: 1607936946
Will run 4 of 4 specs

Failure [0.011 seconds]
[BeforeSuite] BeforeSuite
/Users/apple/code/open-source/blockchain/hyperledger/fabric/integration/nwo/nwo_suite_test.go:29

missing required image: hyperledger/fabric-ccenv:latest

/Users/apple/code/open-source/blockchain/hyperledger/fabric/integration/nwo/buildserver.go:56
------------------------------

Ran 4 of 0 Specs in 0.512 seconds
FAIL! -- 0 Passed | 4 Failed | 0 Pending | 0 Skipped
--- FAIL: TestNewWorldOrder (0.51s)
FAIL

Ginkgo ran 1 suite in 3.561084735s
Test Suite Failed

3、从脚本运行中的信息可以直到依赖了哪些软件:

5.添加更多的依赖

1
2
3
4
5
6
# 添加 gnu-tar
brew install gnu-tar --with-default-names
# 添加 libtool
brew install libtool
# 编译 configtxgen
make configtxgen