Error while running make command using Fabric 1.0.6 after all the 15 steps

扶醉桌前 提交于 2019-12-11 09:25:14

问题


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


回答1:


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




回答2:


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 ;)




回答3:


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.



来源:https://stackoverflow.com/questions/48786309/error-while-running-make-command-using-fabric-1-0-6-after-all-the-15-steps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!