rocksdb编译步骤——Java、Golang、mac
如果不是必要不建议自己编译rocksdb,编译的过程比较耗时费力。现在已经有很多编译好的文件可供使用。
Java
<!-- https://mvnrepository.com/artifact/org.rocksdb/rocksdbjni -->
<dependency>
<groupId>org.rocksdb</groupId>
<artifactId>rocksdbjni</artifactId>
<version>5.10.3</version>
</dependency>
Go版本
https://github.com/leeyazhou/gorocksdb.git
Mac 环境安装:
brew install rocksdb
以下是rocksdb的编译教程步骤:
https://github.com/facebook/rocksdb/blob/master/INSTALL.md
Compilation
Important: If you plan to run RocksDB in production, don't compile using default make or make all. That will compile RocksDB in debug mode, which is much slower than release mode.
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.
There are few options when compiling RocksDB:
[recommended]
make static_libwill compile librocksdb.a, RocksDB static library. Compiles static library in release mode.make shared_libwill compile librocksdb.so, RocksDB shared library. Compiles shared library in release mode.make checkwill compile and run all the unit tests.make checkwill compile RocksDB in debug mode.make allwill compile our static library, and all our tools and unit tests. Our tools depend on gflags. You will need to have gflags installed to runmake all. This will compile RocksDB in debug mode. Don't use binaries compiled bymake allin production.By default the binary we produce is optimized for the platform you're compiling on (
-march=nativeor the equivalent). SSE4.2 will thus be enabled automatically if your CPU supports it. To print a warning if your CPU does not support SSE4.2, build withUSE_SSE=1 make static_libor, if using CMake,cmake -DFORCE_SSE42=ON. If you want to build a portable binary, addPORTABLE=1before your make commands, like this:PORTABLE=1 make static_lib.
Dependencies
You can link RocksDB with following compression libraries:
All our tools depend on:
- gflags - a library that handles command line flags processing. You can compile rocksdb library even if you don't have gflags installed.
Supported platforms
Linux - Ubuntu
- Upgrade your gcc to version at least 4.8 to get C++11 support.
- Install gflags. First, try:
sudo apt-get install libgflags-devIf this doesn't work and you're using Ubuntu, here's a nice tutorial: (http://askubuntu.com/questions/312173/installing-gflags-12-04) - Install snappy. This is usually as easy as:
sudo apt-get install libsnappy-dev. - Install zlib. Try:
sudo apt-get install zlib1g-dev. - Install bzip2:
sudo apt-get install libbz2-dev. - Install lz4:
sudo apt-get install liblz4-dev. - Install zstandard:
sudo apt-get install libzstd-dev.
Linux - CentOS / RHEL
- Upgrade your gcc to version at least 4.8 to get C++11 support:
yum install gcc48-c++ Install gflags:
git clone https://github.com/gflags/gflags.git
cd gflags
git checkout v2.0
./configure && make && sudo make installNotice: Once installed, please add the include path for gflags to your
CPATHenvironment variable and the lib path toLIBRARY_PATH. If installed with default settings, the include path will be/usr/local/includeand the lib path will be/usr/local/lib.Install snappy:
sudo yum install snappy snappy-develInstall zlib:
sudo yum install zlib zlib-develInstall bzip2:
sudo yum install bzip2 bzip2-develInstall lz4:
sudo yum install lz4-develInstall ASAN (optional for debugging):
sudo yum install libasanInstall zstandard:
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
- Upgrade your gcc to version at least 4.8 to get C++11 support:
OS X:
- Install latest C++ compiler that supports C++ 11:
- Update XCode: run
xcode-select --install(or install it from XCode App's settting). - Install via homebrew.
- If you're first time developer in MacOS, you still need to run:
xcode-select --installin your command line. - run
brew tap homebrew/versions; brew install gcc48 --use-llvmto install gcc 4.8 (or higher).
- If you're first time developer in MacOS, you still need to run:
- Update XCode: run
- run
brew install rocksdb
- Install latest C++ compiler that supports C++ 11:
FreeBSD (11.01):
You can either install RocksDB from the Ports system using
cd /usr/ports/databases/rocksdb && make install, or you can follow the details below to install dependencies and compile from source code:Install the dependencies for RocksDB:
export BATCH=YES cd /usr/ports/devel/gmake && make install cd /usr/ports/devel/gflags && make install
cd /usr/ports/archivers/snappy && make install cd /usr/ports/archivers/bzip2 && make install cd /usr/ports/archivers/liblz4 && make install cd /usr/ports/archivesrs/zstd && make install
cd /usr/ports/devel/git && make install
Install the dependencies for RocksJava (optional):
export BATCH=yes cd /usr/ports/java/openjdk7 && make install
Build RocksDB from source: cd ~ git clone https://github.com/facebook/rocksdb.git cd rocksdb gmake static_lib
Build RocksJava from source (optional): cd rocksdb export JAVA_HOME=/usr/local/openjdk7 gmake rocksdbjava
iOS:
- Run:
TARGET_OS=IOS make static_lib. When building the project which uses rocksdb iOS library, make sure to define two important pre-processing macros:ROCKSDB_LITEandIOS_CROSS_COMPILE.
- Run:
Windows:
- For building with MS Visual Studio 13 you will need Update 4 installed.
- Read and follow the instructions at CMakeLists.txt
- Or install via vcpkg
- run
vcpkg install rocksdb:x64-windows
- run
AIX 6.1
- Install AIX Toolbox rpms with gcc
Use these environment variables:
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
Solaris Sparc
- Install GCC 4.8.2 and higher.
Use these environment variables:
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"
rocksdb编译步骤——Java、Golang、mac的更多相关文章
- OpenSSL简单介绍及在Windows、Linux、Mac系统上的编译步骤
OpenSSL介绍:OpenSSL是一个强大的安全套接字层password库,囊括基本的password算法.经常使用的密钥和证书封装管理功能及SSL协议.并提供丰富的应用程序供測试或其他目的使用. ...
- Java native代码编译步骤简书
Java native代码编译步骤简书 目的:防止java代码反编译获取密码算法 (1)编写实现类com.godlet.PasswordAuth.java (2)编译java代码javac Passw ...
- mac 安装protobuf,并编译为java,c++,python
1.下载地址:https://code.google.com/p/protobuf/downloads/list 另外,可以查看这个链接查看中文更多内容:http://www.cnblogs.com/ ...
- webrtc所有平台下载编译步骤详细说明
webrtc所有平台下载编译步骤详细说明 1.安装depot tools Windows:国外下载:https://storage.googleapis.com/chrome-infra/depot_ ...
- 使用NppExec插件让Notepad++编译运行Java、Python
一直希望有一个轻量级的编辑器,既可以编辑代码,也可以一键运行.后来有了NotePad++,希望可以配置配置达到目的,配Java的时候上网搜了一堆,基本上互相抄,不解决实际问题,很郁闷.后来琢磨了出来, ...
- 从源码(编译)安装golang 二
h1 { margin-top: 0.6cm; margin-bottom: 0.58cm; direction: ltr; color: #000000; line-height: 200%; te ...
- 第一章.java&golang的区别之:闭包
对于golang一直存有觊觎之心,但一直苦于没有下定决心去学习研究,最近开始接触golang.就我个人来说,学习golang的原动力是因为想要站在java语言之外来审视java和其它语言的区别,再就是 ...
- Android APK反编译步骤
反编译步骤 1.通过Android Killer 打开apk,自动开始分析 2.分析结束后,在分析好的工程上右键->打开方式->打开文件位置 在文件夹ProjectSrc中有文 ...
- 通过反编译看Java String及intern内幕--费元星站长
通过反编译看Java String及intern内幕 一.字符串问题 字符串在我们平时的编码工作中其实用的非常多,并且用起来也比较简单,所以很少有人对其做特别深入的研究.倒是面试或者笔试的时候,往 ...
随机推荐
- 什么是 VxLAN?
本文首发于我的公众号 Linux云计算网络(id: cloud_dev),专注于干货分享,号内有 10T 书籍和视频资源,后台回复「1024」即可领取,欢迎大家关注,二维码文末可以扫. VLAN 和 ...
- eclipse的安装与使用方法
eclipse的安装与使用方法: eclipse是Java编程利器,工欲善其事必先利其器.下面我们来说说eclipse的安装与使用: 安装分三步: 第一步:安装eclipse 1.官网下载eclips ...
- 使用Appium做手机自动化录制问题
最近在使用appium做Android手机自动化脚本录制, 发现点击“tap”时,一直没有用,页面还是不能跳转. 咋办?发愁... 于是看到旁边有个“sendkeys”,那是不是能够直接发送参数不就行 ...
- C++ 洛谷P1230 智力大冲浪
题目描述 小伟报名参加中央电视台的智力大冲浪节目.本次挑战赛吸引了众多参赛者,主持人为了表彰大家的勇气,先奖励每个参赛者m元.先不要太高兴!因为这些钱还不一定都是你的?!接下来主持人宣布了比赛规则: ...
- C语言学习书籍推荐《C专家编程Expert C Programming Deep C Secrets》下载
Peter Van Der Linden (作者) <C和C++经典著作 C专家编程Expert C Programming Deep C Secrets>展示了C程序员所使用的编码技巧, ...
- 【基础算法-模拟-例题-*校长的问题】-C++
为什么在题目前面打上星号呢? 这道题的正解不是模拟! 正解树状数组! 正解树状数组! 正解树状数组! 重要的事情说够三遍了! 但是,歪解模拟因为数据水都能AC! 因为这道题放在模拟专题中,所以我们就讨 ...
- 各类最短路算法基本模板-C++
原文转自:https://blog.csdn.net/changjiale110/article/details/77394650 感谢. #define Max 0x3f3f3f3f #define ...
- 开发板编译./camera显示-/bin/sh: ./camera: not found解决方案
问题: 开发板根文件系统目录: 运行./camera显示: 问题解决: 1.排除根目录路径问题: 2. 加入静态链接库即无问题,但是编译后的".o"文件大小突增,而且也不可能每次编 ...
- OnCommandStateChange 不响应
原因是我把原先的OnCommandStateChange( long nCommand, BOOL bEnable )大BOOL改成了小bool,回调不认识了.
- CentOS下配置apache+gitweb
GitWeb支持多个版本库,可以对多个版本库进行目录浏览(包括历史版本),可以查看文件内容,查看提交历史,提供搜索及 RSS feed支持,也可以提供目录文件的打包下载等.可以看https://git ...