Fabric环境搭建过程中遇到的问题

1、使用make cryptogen编译生成cryptogen工具

报错信息:

build/bin/cryptogen
CGO_CFLAGS=" " GOBIN=/opt/gopath/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.1" github.com/hyperledger/fabric/common/tools/cryptogen
# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
vendor/github.com/miekg/pkcs11/pkcs11.go:29:18: fatal error: ltdl.h: No such file or directory
compilation terminated.
Makefile:227: recipe for target 'build/bin/cryptogen' failed
make: *** [build/bin/cryptogen] Error 2

缺少ltdl.h文件

解决:下载libltdl-dev,就好了

$ apt-get install libtool libltdl-dev
root@hyperledger:/opt/gopath/src/github.com/hyperledger/fabric# make cryptogen
build/bin/cryptogen
CGO_CFLAGS=" " GOBIN=/opt/gopath/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.1" github.com/hyperledger/fabric/common/tools/cryptogen
Binary available as build/bin/cryptogen

2、调用链码执行函数时,错误信息:

DEBU 005 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host"; Reconnecting to {orderer.example.com:7050 <nil>}
Error: Error getting broadcast client: Error connecting to orderer.example.com:7050 due to context deadline exceeded

这个错误是因为orderer节点的blockfile文件被修改了的原因,遇到这种错误可能就需要重新配置fabric环境了。

可以通过docker ps命令查看orderer容器是否已经异常退出。

查看dockerfile文件:find / -name "*blockfile_000*",可以查出来所有节点的数据文件。

3、生成cryptogen和configtxgen工具的时候,报如下错误:

ubuntu@ubuntu-mizuho-1:/opt/gopath/src/github.com/hyperledger/fabric$ sudo make cryptogen
can't load package: package github.com/hyperledger/fabric/core/chaincode/shim: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of:
	/usr/lib/go-1.7/src/github.com/hyperledger/fabric/core/chaincode/shim (from $GOROOT)
	($GOPATH not set)
find: ‘/src/github.com/hyperledger/fabric/core/chaincode/shim’: No such file or directory
build/bin/cryptogen
CGO_CFLAGS=" " GOBIN=/opt/gopath/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.1" github.com/hyperledger/fabric/common/tools/cryptogen
can't load package: package github.com/hyperledger/fabric/common/tools/cryptogen: cannot find package "github.com/hyperledger/fabric/common/tools/cryptogen" in any of:
	/usr/lib/go-1.7/src/github.com/hyperledger/fabric/common/tools/cryptogen (from $GOROOT)
	($GOPATH not set)
Makefile:227: recipe for target 'build/bin/cryptogen' failed
make: *** [build/bin/cryptogen] Error 1

明明配置了环境变量,却说$GOPATH not set,原因可能是在root用户下环境变量的设置和ubuntu用户下环境变量的设置不一样,建议设置成一样的环境变量。或者在root用户下生成工具。

4、在Java-sdk中调用链码的时候,背书完成之后往排序节点发送读写集的时候,报如下错误:

The proposal responses have 2 inconsistent groups with 0 that are invalid. Expected all to be consistent and none to be invalid.

造成这个错误的原因是有几个节点的背书的结果不一致,这个就要根据自己的实际情况来找出到底是什么原因造成的啦。我当时是因为关闭docker容器的时候,之前的链码容器没有清除,导致有几个节点用的是旧链码,所以背书的结果不一致。


错误持续更新中......

猜你喜欢

转载自blog.csdn.net/MisshqZzz/article/details/79557018