10.26 27 编译遇到的问题及解决方法 - Agzs/geth-pbft-study GitHub Wiki
编译遇到的问题及解决方法
1、gorocksdb包问题
通过go get 获取最新的gorocsdb,遇到
file: 'file:///home/zhiguo/go/src/github.com/tecbot/gorocksdb/db.go'
severity: 'Error'
message: '# github.com/tecbot/gorocksdb
could not determine kind of name for C.rocksdb_cache_get_pinned_usage
could not determine kind of name for C.rocksdb_cache_get_usage
'
at: '1,1'
source: ''
查看tecbot/gorocksdb说明文档发现,需要在系统上先build RocksDB v5.5+.
根据facebook/rocksdb安装文档,参考安装rocksdb博客,发现仍未解决问题。
最终临时解决方法:比较最新的tecbot/gorocksdb(有49个文件)和fabric/vendor/github/tecbot/gorocksdb(有29个文件),尝试在gopath/src/github.com目录下,删除最新的tecbot/gorocksdb,然后复制粘贴fabric/vendor/github目录下tecbot/gorocksdb`,
最终项目可进行编译。
在编译的过程中又遇到如下错误:
github.com/tecbot/gorocksdb
github.com/yeongchingtarn/geth-pbft/core/db
github.com/yeongchingtarn/geth-pbft/consensus/pbft
github.com/yeongchingtarn/geth-pbft/eth
github.com/yeongchingtarn/geth-pbft/les
github.com/yeongchingtarn/geth-pbft/ethstats
github.com/yeongchingtarn/geth-pbft/contracts/release
github.com/yeongchingtarn/geth-pbft/cmd/utils
github.com/yeongchingtarn/geth-pbft/cmd/faucet
github.com/yeongchingtarn/geth-pbft/cmd/bootnode
# github.com/yeongchingtarn/geth-pbft/cmd/faucet
2017/10/27 09:18:08 duplicate symbol _cgoexp_4c7b26b16232_gorocksdb_compactionfilter_filter (types 1 and 1) in github.com/hyperledger/fabric/vendor/github.com/tecbot/gorocksdb and /home/ethtest/go/pkg/linux_amd64/github.com/tecbot/gorocksdb.a(_go_.o)
github.com/yeongchingtarn/geth-pbft/cmd/evm
# github.com/yeongchingtarn/geth-pbft/cmd/bootnode
2017/10/27 09:18:08 duplicate symbol _cgoexp_4c7b26b16232_gorocksdb_compactionfilter_filter (types 1 and 1) in github.com/hyperledger/fabric/vendor/github.com/tecbot/gorocksdb and /home/ethtest/go/pkg/linux_amd64/github.com/tecbot/gorocksdb.a(_go_.o)
github.com/yeongchingtarn/geth-pbft/cmd/geth
# github.com/yeongchingtarn/geth-pbft/cmd/evm
2017/10/27 09:18:09 duplicate symbol _cgoexp_4c7b26b16232_gorocksdb_compactionfilter_filter (types 1 and 1) in github.com/hyperledger/fabric/vendor/github.com/tecbot/gorocksdb and /home/ethtest/go/pkg/linux_amd64/github.com/tecbot/gorocksdb.a(_go_.o)
# github.com/yeongchingtarn/geth-pbft/cmd/geth
2017/10/27 09:18:09 duplicate symbol _cgoexp_4c7b26b16232_gorocksdb_compactionfilter_filter (types 1 and 1) in github.com/hyperledger/fabric/vendor/github.com/tecbot/gorocksdb and /home/ethtest/go/pkg/linux_amd64/github.com/tecbot/gorocksdb.a(_go_.o)
发现某些类型重复
临时解决方法:将fabric/vendor/tecbot/gorocksdb删除,项目可编译
2、可执行程序
在geth-pbft目录下,终端运行go install ./cmd/geth只生成geth可执行文件,而通过go install ./...编译所有的geth-pbft文件,生成七个可执行文件:abigen、bootnode、evm、faucet、geth、puppeth、rlpdump,都位于gopath/bin目录下,其中会用到的有geth和puppeth
但是,系统存在之前安装的geth和puppeth,位于usr/bin目录下,将其通过sudo mv XXX /home/ethtest/gethexe移动到其他目录下。如果不进行此操作,在终端运行的geth和puppeth都是之前安装的版本,并非本次编译生成的可执行文件。
若要测试编译生成的geth和puppeth,可在gopath/bin目录下将可执行文件重命名,比如geth2、puppeth2,然后运行。