若是不是必要不建议本身编译rocksdb,编译的过程比较耗时费力。如今已经有不少编译好的文件可供使用。
Javajava
<!-- https://mvnrepository.com/artifact/org.rocksdb/rocksdbjni --> <dependency> <groupId>org.rocksdb</groupId> <artifactId>rocksdbjni</artifactId> <version>5.10.3</version> </dependency>
Go版本c++
https://github.com/leeyazhou/gorocksdb.git
Mac 环境安装:git
brew install rocksdb
如下是rocksdb的编译教程步骤:github
makemake all
RocksDB's library should be able to compile without any dependency installed, although we recommend installing some compression libraries (see below). We do depend on newer gcc/clang with C++11 support.windows
There are few options when compiling RocksDB:xcode
make static_libmake shared_libmake checkmake checkmake allmake allmake all-march=nativeUSE_SSE=1 make static_libcmake -DFORCE_SSE42=ONPORTABLE=1PORTABLE=1 make static_lib
Dependencies
-
You can link RocksDB with following compression libraries:
-
All our tools depend on:
Supported platforms
git clone https://github.com/gflags/gflags.git cd gflags git checkout v2.0 ./configure && make && sudo make install
sudo yum install snappy snappy-devel
sudo yum install zlib zlib-devel
sudo yum install bzip2 bzip2-devel
sudo yum install lz4-devel
sudo yum install libasan
wget https://github.com/facebook/zstd/archive/v1.1.3.tar.gz mv v1.1.3.tar.gz zstd-1.1.3.tar.gz tar zxvf zstd-1.1.3.tar.gz cd zstd-1.1.3 make && sudo make install
export PORTABLE=1 export CC=gcc export AR="ar -X64" export EXTRA_ARFLAGS=-X64 export EXTRA_CFLAGS=-maix64 export EXTRA_CXXFLAGS=-maix64 export PLATFORM_LDFLAGS="-static-libstdc++ -static-libgcc" export LIBPATH=/opt/freeware/lib export JAVA_HOME=/usr/java8_64 export PATH=/opt/freeware/bin:$PATH
export CC=gcc export EXTRA_CFLAGS=-m64 export EXTRA_CXXFLAGS=-m64 export EXTRA_LDFLAGS=-m64 export PORTABLE=1 export PLATFORM_LDFLAGS="-static-libstdc++ -static-libgcc"