Search code examples
hyperledger-fabrichyperledgerhyperledger-fabric-ca

panic: Version is not set for fabric-ca library


I followed the below link to install hyperledger fabric ca:

http://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html#setting-up-multiple-cas

which specifies the below command to install:

go get -u github.com/hyperledger/fabric-ca/cmd/...

I have all the dependencies:

Go version: 1.9.6

GOPATH environment variable is set correctly

libtool and libtdhl-dev packages are installed

However, when I run the fabric-ca-server natively, I get the following error: enter image description here

In words, the error is shown below:

2018/06/29 13:32:20 [INFO] Configuration file location: /home/abhinay-trana/crypto-config/peerOrganizations/org1.com/ca/root/fabric-ca-server-config.yaml

panic: Version is not set for fabric-ca library

goroutine 1 [running]:

github.com/hyperledger/fabric-ca/lib/metadata.GetVersion(0x779657, 0xc4202d26c0) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/lib/metadata/version.go:58 +0x60

github.com/hyperledger/fabric-ca/lib.(*Server).init(0xc4202d26c0, 0xc4202b5000, 0xf6ce32, 0xc420165bf0) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/lib/server.go:98 +0x29

github.com/hyperledger/fabric-ca/lib.(*Server).Init(0xc4202d26c0, 0xc4202d2600, 0x0, 0xc420165c50) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/lib/server.go:88 +0x38

main.(*ServerCmd).init.func2(0xc42009cd80, 0xc4200f7ec0, 0x0, 0x2, 0x0, 0x0) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/cmd/fabric-ca-server/servercmd.go:102 +0xfc

github.com/hyperledger/fabric-ca/vendor/github.com/spf13/cobra.(*Command).execute(0xc42009cd80, 0xc4200f7d20, 0x2, 0x2, 0xc42009cd80, 0xc4200f7d20) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/vendor/github.com/spf13/cobra/command.go:643 +0x3e8

github.com/hyperledger/fabric-ca/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc42009cb40, 0xd6f246, 0xc420092c30, 0xc420092c30) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/vendor/github.com/spf13/cobra/command.go:734 +0x2fe

github.com/hyperledger/fabric-ca/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42009cb40, 0xc42011a3c0, 0xc420092c30) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/vendor/github.com/spf13/cobra/command.go:692 +0x2b

main.(*ServerCmd).Execute(0xc420092c30, 0x4, 0x1) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/cmd/fabric-ca-server/servercmd.go:69 +0x2f

main.RunMain(0xc420094040, 0x4, 0x4, 0xc420165f70, 0xd70a0b) /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/cmd/fabric-ca-server/main.go:45 +0xb0

main.main() /home/abhinay-trana/go/src/github.com/hyperledger/fabric-ca/cmd/fabric-ca-server/main.go:27 +0x45

How do I set the version for the fabric ca library? Can some one help me?


Solution

  • The following procedure solved the problem for me:

    The error message said: 'go/src/github.com/hyperledger/fabric-ca/lib/metadata/version.go:58 +0x60'. A peek into the version.go file showed me the following comment:

    // Version specifies fabric-ca-client/fabric-ca-server version

    // It is defined by the Makefile and passed in with ldflags

    Hence, I did a make from go/src/github.com/hyperledger/fabric-ca/. During the make, the below message was printed to the screen:

    [INFO] Server Version: 1.1.1-snapshot-e656889

    After the make, when I start the fabric-ca-server present in go/src/github.com/hyperledger/fabric-ca/bin, its running fine!