Skip to content

Build Steps

Sergei Petrunia edited this page Apr 2, 2017 · 40 revisions

Supported platforms

The subset of platforms we officially support is following:

  • CentOS 6.8
  • CentOS 7.2.x

Compiler toolsets we verify our builds internally are the following:

  • gcc 4.9.0
  • gcc 5.4.0
  • gcc 6.1.0
  • Clang 3.9.0

Note: We no longer test against gcc 4.8.1 internally but support its use externally.

Best effort is made to support the following OS-s:

  • Ubuntu 14.04.4 LTS
  • Ubuntu 15.10
  • Ubuntu 16.04 LTS

Known problems

  • Compiling with DTrace enabled on Fedora is not supported (works fine with Ubuntu 15.10 though).

If you're using any other platform then we would appreciate your help with getting MyRocks compiling and working there!

Installing on Ubuntu 14.04.2 LTS

Setting up prerequisites

On a fresh AWS Ubuntu 14.04.2 LTS instance:

sudo apt-get update
sudo apt-get -y install g++ cmake libbz2-dev libaio-dev bison \
zlib1g-dev libsnappy-dev 
sudo apt-get -y install libgflags-dev libreadline6-dev libncurses5-dev \
libssl-dev liblz4-dev gdb git

If you intend to run MTR tests, they use python and DBD::MySQL, so you'll need:

sudo apt-get install -y python python-mysqldb
sudo apt-get install -y libdbd-mysql libdbi-perl libdbd-mysql-perl

On Fedora and perhaps Redhat:

sudo yum install cmake gcc-c++ bzip2-devel libaio-devel bison \
zlib-devel snappy-devel
sudo yum install gflags-devel readline-devel ncurses-devel \
openssl-devel lz4-devel gdb git

Then setup the git repository:

git clone https://github.com/facebook/mysql-5.6.git
cd mysql-5.6
git submodule init
git submodule update
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=system \
-DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=0 -DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 -DCMAKE_CXX_FLAGS="-march=native"
make -j8

Different build types

  • If you need a debug build, run CMake as follows.
cmake . -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=system \
-DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=1 -DENABLE_DTRACE=0
  • If you want to produce a TSan build then now you can do this by adding the following option to CMake command-line:
-DWITH_TSAN=1
  • If you want to produce a UBSan build then now you can do this by adding the following option to CMake command-line:
-DWITH_UBSAN=1
  • If you want to build with Clang (verified on Ubuntu 16.04 LTS) then you can do this by adding the following switches to the CMake command-line:
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++

Adding support for compression libraries

RocksDB itself supports multiple compression algorithms. By default, MyRocks only links with Zlib. You can add support for Snappy, BZip2, LZ4, and ZSTD libraries as well. You will need to know where a static library (.a file) for a particular compression algorithm is located and then set an environment variable to require including the library at a compile time.

Let's look at an example which assumes that we want to use Snappy. We know that libsnappy.a is located under /usr/lib/x86_64-linux-gnu and therefore we'll set WITH_SNAPPY as follows:

export WITH_SNAPPY=/usr/lib/x86_64-linux-gnu
cmake ...
make ...

In a similar manner you can set WITH_BZ2, WITH_LZ4, and WITH_ZSTD to support BZip2, LZ4, and ZSTD.

Running mtr tests

cd mysql-test
./mysql-test-run.pl --mem --async-client --parallel=16 --fast \
--max-test-fail=1000 --retry=0 --force --mysqld=--rocksdb \
--mysqld=--default-storage-engine=rocksdb --mysqld=--skip-innodb \
--mysqld=--default-tmp-storage-engine=MyISAM --suite=rocksdb

Installing linkbench

sudo apt-get install openjdk-7-jdk maven
git clone https://github.com/facebook/linkbench.git
cd linkbench;
mvn clean package -P fast-test
Clone this wiki locally