无法编译链码

问题描述 投票:4回答:3

我正在尝试编译chaincode_example02,然后使用选项2(对于Mac)编译guide。除编译代码外,所有步骤均已通过。我有以下错误:

cd $GOPATH/src/github.com/chaincode_example02
go build
chaincode_example02.go:30:2: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of:
    /usr/local/Cellar/go/1.7.1/libexec/src/github.com/hyperledger/fabric/core/chaincode/shim (from $GOROOT)
    ($GOPATH not set)
hyperledger hyperledger-fabric
3个回答
4
投票

“Fabric”源代码应该在您的GOPATH中本地可用。

cd $GOPATH/src/github.com
mkdir hyperledger
cd hyperledger
git clone http://gerrit.hyperledger.org/r/fabric

2
投票

您需要以libs follow命令准备Fabric结构源。确保首先设置了GOPATH。

mkdir -p $GOPATH/src/github.com/hyperledger
cd $GOPATH/src/github.com/hyperledger
git clone -b release-1.2 https://github.com/hyperledger/fabric.git

0
投票

正如它在错误消息中所述,您的GOPATH环境变量未正确设置。

在对链码进行构建之前:

  1. 确保您的GOPATH设置正确 按照本指南https://golang.org/doc/code.html#GOPATH) 做echo $GOPATH检查GOPATH的价值
  2. 确保你的GOPATH中有结构代码
© www.soinside.com 2019 - 2024. All rights reserved.