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

huangapple go评论89阅读模式
英文:

Go build fail, fatal error: rocksdb/c.h

问题

我正在测试项目obc-peer

我对于从github.com/,golang.org/,google.golang.org/****,google/****获取的位置感到困惑。
关于$GOPATH,我错了吗?

这是go build和go 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.

英文:

I am testing on project obc-peer.

I am confused where should I get about github.com/**** , golang.org/**** , google.golang.org/**** , google/****.
Am I wrong about $GOPATH ?

Here is the log of go build and go env:

Hope someone can help me on it......Gods

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.

答案1

得分: 1

看起来你还没有安装 RocksDB 库。

英文:

Looks like you haven't installed rocksdb library

答案2

得分: 1

我已经按照你提供的链接进行了操作。

配置RocksDB相关依赖项:

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

运行go install - CGO flags for RocksDB:

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
英文:

I followed here and it is done.
https://github.com/openblockchain/obc-peer/issues/885

Configure RocksDB related deps

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

Run go install - CGO flags for RocksDB

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

答案3

得分: 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
英文:

You need to set LD_LIBRARY_PATH using

export LD_LIBRARY_PATH=/opt/rocksdb

before executing

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

huangapple
  • 本文由 发表于 2016年3月29日 17:13:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/36280024.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定