gohyperledger-fabriccgoldflags

invalid flag #cgo LDFLAGS break build with go lang


I'm new to the go-lang. I want to use go command to build a binary named cryptogen (hyperledger/fabric tool). I download the source code from github and type the following command accroding to readme:

CGO_CFLAGS=" " GOBIN=/hyperledger/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.7" github.com/hyperledger/fabric/common/tools/cryptogen

On my Mac OS (OS version is 10.13, go-lang version is 1.10) I'm getting the following error:

go build github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11: invalid flag in #cgo LDFLAGS: -I/usr/local/share/libtool

I thought I missing libtool, after installed it, I'm still getting the same error.

What can I do next?


Solution

  • Just as an FYI, PKCS11 is not really required to use cryptogen. You can actually use -tags "nopkcs11"