如果不是必要不建议自己编译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_lib will compile librocksdb.a, RocksDB static library. Compiles static library in release mode.

  • make shared_lib will compile librocksdb.so, RocksDB shared library. Compiles shared library in release mode.

  • make check will compile and run all the unit tests. make check will compile RocksDB in debug mode.

  • make all will compile our static library, and all our tools and unit tests. Our tools depend on gflags. You will need to have gflags installed to run make all. This will compile RocksDB in debug mode. Don't use binaries compiled by make all in production.

  • By default the binary we produce is optimized for the platform you're compiling on (-march=native or 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_lib or, if using CMake, cmake -DFORCE_SSE42=ON. If you want to build a portable binary, add PORTABLE=1 before your make commands, like this:PORTABLE=1 make static_lib.

Dependencies

  • You can link RocksDB with following compression libraries:

    • zlib - a library for data compression.
    • bzip2 - a library for data compression.
    • lz4 - a library for extremely fast data compression.
    • snappy - a library for fast data compression.
    • zstandard - Fast real-time compression algorithm.
  • 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-dev If 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 install

      Notice: Once installed, please add the include path for gflags to your CPATH environment variable and the lib path to LIBRARY_PATH. If installed with default settings, the include path will be /usr/local/include and the lib path will be /usr/local/lib.

    • Install snappy:

        sudo yum install snappy snappy-devel
    • Install zlib:

        sudo yum install zlib zlib-devel
    • Install bzip2:

        sudo yum install bzip2 bzip2-devel
    • Install lz4:

        sudo yum install lz4-devel
    • Install ASAN (optional for debugging):

        sudo yum install libasan
    • Install 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
  • 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 --install in your command line.
        • run brew tap homebrew/versions; brew install gcc48 --use-llvmto install gcc 4.8 (or higher).
    • run brew install rocksdb
  • 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_LITE and IOS_CROSS_COMPILE.
  • 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
  • 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的更多相关文章

  1. OpenSSL简单介绍及在Windows、Linux、Mac系统上的编译步骤

    OpenSSL介绍:OpenSSL是一个强大的安全套接字层password库,囊括基本的password算法.经常使用的密钥和证书封装管理功能及SSL协议.并提供丰富的应用程序供測试或其他目的使用. ...

  2. Java native代码编译步骤简书

    Java native代码编译步骤简书 目的:防止java代码反编译获取密码算法 (1)编写实现类com.godlet.PasswordAuth.java (2)编译java代码javac Passw ...

  3. mac 安装protobuf,并编译为java,c++,python

    1.下载地址:https://code.google.com/p/protobuf/downloads/list 另外,可以查看这个链接查看中文更多内容:http://www.cnblogs.com/ ...

  4. webrtc所有平台下载编译步骤详细说明

    webrtc所有平台下载编译步骤详细说明 1.安装depot tools Windows:国外下载:https://storage.googleapis.com/chrome-infra/depot_ ...

  5. 使用NppExec插件让Notepad++编译运行Java、Python

    一直希望有一个轻量级的编辑器,既可以编辑代码,也可以一键运行.后来有了NotePad++,希望可以配置配置达到目的,配Java的时候上网搜了一堆,基本上互相抄,不解决实际问题,很郁闷.后来琢磨了出来, ...

  6. 从源码(编译)安装golang 二

    h1 { margin-top: 0.6cm; margin-bottom: 0.58cm; direction: ltr; color: #000000; line-height: 200%; te ...

  7. 第一章.java&golang的区别之:闭包

    对于golang一直存有觊觎之心,但一直苦于没有下定决心去学习研究,最近开始接触golang.就我个人来说,学习golang的原动力是因为想要站在java语言之外来审视java和其它语言的区别,再就是 ...

  8. Android APK反编译步骤

    反编译步骤 1.通过Android Killer 打开apk,自动开始分析   2.分析结束后,在分析好的工程上右键->打开方式->打开文件位置     在文件夹ProjectSrc中有文 ...

  9. 通过反编译看Java String及intern内幕--费元星站长

    通过反编译看Java String及intern内幕   一.字符串问题 字符串在我们平时的编码工作中其实用的非常多,并且用起来也比较简单,所以很少有人对其做特别深入的研究.倒是面试或者笔试的时候,往 ...

随机推荐

  1. Go 程序是怎样跑起来的

    目录 引入 编译链接概述 编译过程 词法分析 语法分析 语义分析 中间代码生成 目标代码生成与优化 链接过程 Go 程序启动 GoRoot 和 GoPath Go 命令详解 go build go i ...

  2. Android中控件属性详细总结(转载)

    转载地址:https://www.cnblogs.com/nanguojs/p/5950510.html 1.LinearLayout(线性布局): 可以分为水平线性:android:orientat ...

  3. Programming In Lua 第七章

    1, 2, 3, 第三点需要讲解下:for循环中,allwords函数是工厂函数,只调用一次.for循环的每次遍历,都会调用工厂函数返回的闭包函数.这样就能遍历一个文件的每一行的每一个单词. 4, 我 ...

  4. python爬虫之快速对js内容进行破解

    python爬虫之快速对js内容进行破解 今天介绍下数据被js加密后的破解方法.距离上次发文已经过去半个多月了,我写文章的主要目的是把从其它地方学到的东西做个记录顺便分享给大家,我承认自己是个懒猪.不 ...

  5. HDU 6060:RXD and dividing(DFS)

    题目链接 题意 给出n个点,要把除1以外的点分成k个集合,然后对于每个集合要和1这个点一起求一个最小生成树,然后问这k个最小生成树的最大总和是多少. 思路 因为每个集合都包含1这个点,因此对于每个点都 ...

  6. restapi(0)- 平台数据维护,写在前面

    在云计算的推动下,软件系统发展趋于平台化.云平台系统一般都是分布式的集群系统,采用大数据技术.在这方面akka提供了比较完整的开发技术支持.我在上一个系列有关CQRS的博客中按照实际应用的要求对akk ...

  7. 剑指offer第二版-总结:二叉树的遍历

    思想:前序(根左右),中序(左根右),后序(左右根) 前序非递归遍历: 首先判断根是否为空,将根节点入栈 1.若栈为空,则退出循环 2.将栈顶元素弹出,访问弹出的节点 3.若弹出的节点的右孩子不为空则 ...

  8. 从壹开始[ 做贡献 ]之三 || 北京.Net俱乐部活动——DNT精英论坛开幕

    缘起 哈喽大家好!好久不见,可能有一部分小伙伴发现我好久没有写文章了,是不是懒惰了,并没有,这两周也是正式开始了<NetCore系列教程的视频录制>,不过还不多,预计会是每周一个视频,基本 ...

  9. web安全测试必须注意的五个方面

    随着互联网的飞速发展,web应用在软件开发中所扮演的角色变得越来越重要,同时,web应用遭受着格外多的安全攻击,其原因在于,现在的网站以及在网站上运行的应用在某种意义上来说,它是所有公司或者组织的虚拟 ...

  10. STM32F0_HAL库驱动描述——HAL驱动程序概述

    HAL库文件结构: HAL驱动文件: 外设驱动API文件和头文件:包含了常见主要的通用API,其中ppp表示外设名称,如adc.usart.gpio.irda等: stm32f0xx_hal_ppp. ...