Rocksdb Compiling steps

Source: Internet
Author: User
Tags git clone

If it is not necessary to not recommend compiling ROCKSDB yourself, the process of compiling is much more time consuming and laborious. Now there are a lot of compiled files ready to use.

Java

<!--https://mvnrepository.com/artifact/org.rocksdb/rocksdbjni-<dependency>    <groupId>org.rocksdb</groupId>    <artifactId>rocksdbjni</artifactId>    < Version>5.10.3</version></dependency>

Go version

HTTPS://github.com/leeyazhou/gorocksdb.git

MAC Environment Installation:

Brew Install Rocksdb

The following is a compilation tutorial step for Rocksdb:

Https://github.com/facebook/rocksdb/blob/master/INSTALL.mdCompilation

Important: If you plan to run Rocksdb in production, don ' t compile using default make or make all . That would compile Rocksdb in debug mode, which is much slower than release mode.

Rocksdb ' s library should is able to compile without any dependency installed, although we recommend installing some Compre Ssion libraries (see below). We do depend on newer Gcc/clang and c++11 support.

There is few options when compiling ROCKSDB:

  • [Recommended] Would make static_lib compile LIBROCKSDB.A, rocksdb Static library. Compiles static library in release mode.

  • make shared_libWould compile librocksdb.so, Rocksdb shared library. Compiles shared library in release mode.

  • make checkWould compile and run all the unit tests. Would make check compile rocksdb in debug mode.

  • make all  will compile our static library Tools and unit tests. Our tools depend on gflags. You'll need to has gflags installed to Run&NBSP; make all . This would compile ROCKSDB in debug mode. Don ' t use binaries compiled By&NBSP; make all  in production.

  • By default the binary we produce are optimized for the platform you ' re compiling on ( -march=native or the equivalent). SSE4.2 would thus be enabled automatically if your CPU supports it. To print a warning if the your CPU does not the support SSE4.2, the build with USE_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 we tools depend on:

      • GFlags -a library that handles command line flags processing. You can compile rocksdb the library even if you don't have gflags installed.
Supported platforms
  • Linux-ubuntu

    • Upgrade your GCC to version on 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/ques tions/312173/installing-gflags-12-04)
    • Install Snappy. 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 on 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 environment variable and the CPATH Lib path to LIBRARY_PATH . If installed with default settings, the include path would be and the /usr/local/include Lib path would 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 + +:
      • Update XCo De:run&NBSP; xcode-select--install   (or install it from XCode App ' s settting).
      • Install via homebrew.
        • If You ' re first time developer on MacOS, you still need to Run: < Code>xcode-select--install  in your command line.
        • run&NBSP; brew tap homebrew/versions; Brew Install gcc48--USE-LLVM to install GCC 4.8 (or higher).
    • run&NBSP; Brew install Rocksdb
  • FreeBSD (11.01):

    • Can either install Rocksdb from the Ports system using cd /usr/ports/databases/rocksdb && make install , or can follow the details below to install Depen Dencies 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/port S/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, important pre-processing macros: and IOS_CROSS_COMPILE .
  • Windows:

    • For building with MS Visual Studio, you'll 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 Compiling steps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.