1. 程式人生 > >Fabric環境搭建過程中遇到的問題

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
[email protected]:/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工具的時候,報如下錯誤:

[email protected]:/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容器的時候,之前的鏈碼容器沒有清除,導致有幾個節點用的是舊鏈碼,所以背書的結果不一致。

錯誤持續更新中......