Error while running make command using Fabric 1.0.

2019-07-26 15:09发布

I am installing fabric in a custom path $HOME//gopath/src/github.com/hyperledger/fabric using the make command but after installing all the 15 steps, I am getting the following error

Step 15/15 : LABEL org.hyperledger.fabric.version=1.0.2       org.hyperledger.fabric.base.version=0.3.2
 ---> Running in ed05a67810db
Removing intermediate container ed05a67810db
 ---> 99b4b0b28957
Successfully built 99b4b0b28957
Successfully tagged hyperledger/fabric-javaenv:latest
docker tag hyperledger/fabric-javaenv hyperledger/fabric-javaenv:x86_64-1.0.2
build/bin/peer
CGO_CFLAGS=" " GOBIN=/root/gopath/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.2 -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.2 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger" github.com/hyperledger/fabric/peer
go build github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11: invalid flag in #cgo LDFLAGS: -Wl,--no-as-needed
Makefile:227: recipe for target 'build/bin/peer' failed
make: *** [build/bin/peer] Error 1


Docker version 17.12.0-ce, build c97c6d6
docker-compose version 1.18.0, build 8dd22a9
go version go1.9.4 linux/amd64
OS : Ubuntu 16.04

I have set the following path also

$ mkdir $HOME/gopath
$ export GOPATH=$HOME/gopath
$ export GOROOT=$HOME/go
$ export PATH=$PATH:$GOROOT/bin

Jira Link: https://jira.hyperledger.org/browse/FAB-2218 which I have already done

3条回答
祖国的老花朵
2楼-- · 2019-07-26 15:32

as far as I know you don't need to build the fabric itself. You just need to have sources in the gopath, as your chaincode will need this, when you are building your chaincode for the blockchain itself. In addition you will probably also need to install the fabric-ca for your chaincode to build successfully, if you use the certificate-stuff. This is sufficient to check if you installed fabric correctly:

cd $GOPATH/src/github.com/hyperledger/fabric
make unit-test

Keep going if this works. I found this confusing at first as well ;)

查看更多
▲ chillily
3楼-- · 2019-07-26 15:34

I'd assume you switch to golang 1.9.4 or greater hence I belive this actually related to following issue, to solve it you need to update vendor dependencies:

govendor fetch github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11

Next continue to build binaries and run tests.

查看更多
虎瘦雄心在
4楼-- · 2019-07-26 15:43

It is a known issue in go 1.9.4: https://github.com/golang/go/issues/23739

While go people are fixing it, you can manually whitelist the flags before starting make:

$ export CGO_LDFLAGS_ALLOW='-Wl,--no-as-needed'
$ make

Alternatively you can just downgrade to go 1.9.3

查看更多
登录 后发表回答