Is there a way to build hyperledger fabric using gccgo? I want to do this in order to use -finstrument-functions option of gcc to trace function calls. But I encountered two problems. My steps are as follows.
make -n release
echo "Building release/linux-amd64/bin/configtxgen for linux-amd64"
mkdir -p release/linux-amd64/bin CGO_CFLAGS=" "
GOOS=linux GOARCH=amd64 go build -o /home/yiifburj/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/configtxgen -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/tools/configtxgen/metadata.Version=1.1.0" github.com/hyperledger/fabric/common/tools/configtxgen
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -compiler gccgo -o /home/yiifburj/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/configtxgen -tags "nopkcs11" -gccgoflags "-X github.com/hyperledger/fabric/common/tools/configtxgen/metadata.Version=1.1.0" github.com/hyperledger/fabric/common/tools/configtxgen
#github.com/hyperledger/fabric/bccsp/factory
bccsp/factory/pluginfactory.go:12:8: error: import file ‘plugin’ not found
"plugin"bccsp/factory/pluginfactory.go:56:15: error: reference to undefined name
‘plugin’ plug, err := plugin.Open(config.PluginOpts.Library)
First, as above, "plugin" couldn't be found when gccgo is invoked by go build. Another one is how to pass ldflags -X when use gccgo? It seems that -X is a parameter only invalid in gc tools not gccgo.
Anyone can help me? Thanks.
You'll need to use the correct version of GCC in order to get support for the versions of Go supported by the various Fabric releases.
gccgo did not support Go 1.9 (GCC 7 had support for Go 1.8). GCC 8 adds support for Go 1.10.
So you should use Fabric v1.2 and GCC 8.