去构建失败,致命错误:rocksdb / c.h

时间:2016-03-29 09:13:04

标签: go build blockchain hyperledger

我正在测试项目obc-peer

我很困惑我应该在哪里了解github.com/****,golang.org/****,google.golang.org/****,google / ****。 我错了$ GOPATH?

这是go build的日志,然后去env:

希望有人可以帮助我......上帝

vagrant@vagrant-ubuntu-trusty-64:/opt/gopath$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
vagrant@vagrant-ubuntu-trusty-64:/opt/gopath/src/github.com/openblockchain/obc-peer$ go build
# github.com/openblockchain/obc-peer/vendor/github.com/tecbot/gorocksdb
vendor/github.com/tecbot/gorocksdb/backup.go:4:24: fatal error: rocksdb/c.h: No such file or directory
 // #include "rocksdb/c.h"
                        ^
compilation terminated.

3 个答案:

答案 0 :(得分:1)

看起来你还没有安装rocksdb库

答案 1 :(得分:0)

我跟着这里完成了。 https://github.com/openblockchain/obc-peer/issues/885

配置RocksDB相关代数

sudo apt-get install -y libsnappy-dev
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y libbz2-dev

运行go install - RocksDB的CGO标志

cd $GOPATH/src/github.com/openblockchain/obc-peer
CGO_CFLAGS="-I/opt/rocksdb/include" CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install

答案 2 :(得分:0)

您需要使用

设置LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/rocksdb

执行前

CGO_CFLAGS="-I/opt/rocksdb/include" CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install