Skip to content

Building RethinkDB

aborkar-ibm edited this page Sep 8, 2020 · 23 revisions

Building RethinkDB

The instructions specify the steps to build RethinkDB version v2.4.0 on Linux on IBM Z for following distributions:

  • RHEL (7.6, 7.7, 7.8, 8.1, 8.2)
  • SLES (12 SP5, 15 SP1, 15 SP2)
  • Ubuntu (18.04, 20.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it

Step 1: Build and Install RethinkDB

export SOURCE_ROOT=/<source_root>/

1.1) Install the Dependencies

  • RHEL (7.6, 7.7, 7.8)
  sudo yum groupinstall -y 'Development Tools'
  sudo yum install -y python3-devel openssl-devel libcurl-devel wget tar m4 git-core boost-static m4 gcc-c++  ncurses-devel which make ncurses-static zlib-devel zlib-static protobuf protobuf-compiler protobuf-devel
  • RHEL (8.1, 8.2)
  sudo yum groupinstall -y 'Development Tools'
  sudo yum install -y python3-devel python2 openssl-devel libcurl-devel wget tar m4 git-core boost gcc-c++  ncurses-devel which make ncurses zlib-devel zlib procps
  sudo ln -s /usr/bin/python2 /usr/bin/python
  • SLES 12 SP5
  sudo zypper update -y
  sudo zypper install  gcc gcc-c++ make libopenssl-devel zlib-devel wget tar patch curl unzip autoconf automake libtool python python-xml python-curses libicu-devel protobuf-devel libprotobuf-lite9 libprotobuf9 boost-devel termcap curl libcurl-devel git awk 
  • SLES 15 SP1
  sudo zypper update -y
  sudo zypper install -y gcc gcc-c++ make libopenssl-devel zlib-devel wget tar patch curl unzip autoconf automake libtool python3-devel python python-xml python-curses libicu-devel protobuf-devel libprotobuf-lite15 libprotobuf15 boost-devel termcap curl libcurl-devel git bzip2 awk
  • SLES 15 SP2
  sudo zypper update -y
  sudo zypper install -y gcc gcc-c++ make tar xz libopenssl-devel zlib-devel wget patch curl unzip autoconf automake libtool libicu-devel protobuf-devel libprotobuf-c-devel boost-devel termcap libcurl-devel git bzip2 awk gzip readline-devel sqlite3-devel tk-devel ncurses-devel gdbm-devel  libdb-4_8-devel  gawk netcfg libbz2-devel glibc-locale
  • Ubuntu (18.04, 20.04)
 sudo apt-get update
 sudo apt-get install -y clang build-essential python libcurl4-openssl-dev libboost-all-dev libncurses5-dev wget m4 libssl-dev git curl   
  • Install GCC 5.4.0 (For Ubuntu only)
  cd $SOURCE_ROOT
  mkdir gcc
  cd gcc
  wget https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz
  tar -xzf gcc-5.4.0.tar.gz
  cd gcc-5.4.0/
  ./contrib/download_prerequisites
  mkdir objdir
  cd objdir
  ../configure --prefix=/opt/gcc --enable-languages=c,c++ --with-arch=zEC12 --with-long-double-128 \
  	   --build=s390x-linux-gnu --host=s390x-linux-gnu --target=s390x-linux-gnu                  \
  	   --enable-threads=posix --with-system-zlib --disable-multilib
  make -j 8
  sudo make install
  sudo ln -sf /opt/gcc/bin/gcc /usr/bin/gcc
  sudo ln -sf /opt/gcc/bin/g++ /usr/bin/g++
  sudo ln -sf /opt/gcc/bin/g++ /usr/bin/c++
  export PATH=/opt/gcc/bin:"$PATH"
  export LD_LIBRARY_PATH=/opt/gcc/lib64:"$LD_LIBRARY_PATH"
  export C_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-linux-gnu/5.4.0/include
  export CPLUS_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-linux-gnu/5.4.0/include
  • Install Protobuf v2.6.0 (For Ubuntu only)
  cd $SOURCE_ROOT
  wget https://github.com/google/protobuf/releases/download/v2.6.0/protobuf-2.6.0.tar.gz
  tar zxvf protobuf-2.6.0.tar.gz
  cd protobuf-2.6.0
  sed -i '/elif defined(GOOGLE_PROTOBUF_ARCH_MIPS)/i #elif defined(GOOGLE_PROTOBUF_ARCH_S390)' src/google/protobuf/stubs/atomicops.h
  sed -i '/elif defined(GOOGLE_PROTOBUF_ARCH_MIPS)/i #include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>' src/google/protobuf/stubs/atomicops.h
  sed -i '/#define GOOGLE_PROTOBUF_ARCH_64_BIT 1/a #elif defined(__s390x__)' src/google/protobuf/stubs/platform_macros.h
  sed -i '/#elif defined(__s390x__)/a #define GOOGLE_PROTOBUF_ARCH_S390 1' src/google/protobuf/stubs/platform_macros.h
  sed -i '/#define GOOGLE_PROTOBUF_ARCH_S390/a #define GOOGLE_PROTOBUF_ARCH_64_BIT 1' src/google/protobuf/stubs/platform_macros.h
  ./configure
  make
  make check
  sudo make install
  export LD_LIBRARY_PATH=/usr/local/lib
  protoc --version
  • Install Python v2.7.16 (For SLES 15 SP2 only)
  cd $SOURCE_ROOT
  wget https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz
  tar -xvf Python-2.7.16.tar.xz
  sudo ln -sfv /usr/include/ncurses/* /usr/include/
  cd Python-2.7.16
  ./configure --prefix=/usr/local --exec-prefix=/usr/local
  make
  sudo make install
  • Install Node v6.17.0 (For RHEL 8.1 and 8.2)
  cd $SOURCE_ROOT
  wget https://nodejs.org/dist/v6.17.0/node-v6.17.0-linux-s390x.tar.gz
  tar xvf node-v6.17.0-linux-s390x.tar.gz
  export PATH=$SOURCE_ROOT/node-v6.17.0-linux-s390x/bin:$PATH
  export VPYTHON_BYPASS="manually managed python not supported by chrome operations"
  • Install Node v6.11.0 (For SLES 15 SP1 and 15 SP2)
  cd $SOURCE_ROOT
  wget https://nodejs.org/dist/v6.11.0/node-v6.11.0-linux-s390x.tar.gz
  tar xvf node-v6.11.0-linux-s390x.tar.gz
  export PATH=$SOURCE_ROOT/node-v6.11.0-linux-s390x/bin:$PATH
  export VPYTHON_BYPASS="manually managed python not supported by chrome operations"
  • Build and install Protobuf v3.0.0 (For RHEL 8.1 and 8.2)

    Follow the build instruction to build and install Protobuf 3.0.0

1.2) Clone and build RethinkDB

cd $SOURCE_ROOT
git clone https://github.com/rethinkdb/rethinkdb
cd rethinkdb
git checkout v2.4.0
  • Make the following change in mk/support/pkg/v8.sh (For RHEL, SLES, Ubuntu)
@@ -64,9 +64,10 @@ pkg_install-include () {
         # for s390x we need to generate correct header files
         cd $build_dir
         export PATH=$(pwd)/depot_tools:$PATH
+        export CXXFLAGS="-fno-delete-null-pointer-checks"
         #cd v8z
-        make dependencies
-        make s390x -j4 library=static
+        make dependencies || true
+        make s390x -j4 werror=no snapshot=off library=static

         #s390x cp -RL "$src_dir/include/." "$install_dir/include"
         cp -RL "$build_dir/include/." "$install_dir/include"
@@ -168,7 +169,7 @@ pkg_link-flags () {
     # These are the necessary libraries recommended by the docs:
     # https://developers.google.com/v8/get_started#hello
      if [[ "$ARCH" != "ppc64le" ]]; then
-        for lib in libv8_{base,libbase,snapshot,libplatform}; do
+         for lib in libv8_{base,libbase,nosnapshot,libplatform}; do
              echo "$install_dir/lib/$lib.a"
         done
         for lib in libicu{i18n,uc,data}; do
  • Make the following change in mk/support/pkg/v8.sh (For RHEL only)
@@ -60,13 +60,14 @@ pkg_install-include () {
     rm -rf "$install_dir/include"
     mkdir -p "$install_dir/include"

-    if [[ "$($CXX -dumpmachine)" = "s390x-linux-gnu" ]]; then
+    if [[ "$($CXX -dumpmachine)" = "s390x-redhat-linux" ]]; then
         # for s390x we need to generate correct header files
         cd $build_dir
  • Make the following change in mk/support/pkg/v8.sh (For SLES only)
@@ -60,13 +60,14 @@ pkg_install-include () {
     rm -rf "$install_dir/include"
     mkdir -p "$install_dir/include"

-    if [[ "$($CXX -dumpmachine)" = "s390x-linux-gnu" ]]; then
+    if [[ "$($CXX -dumpmachine)" = "s390x-suse-linux" ]]; then
         # for s390x we need to generate correct header files
         cd $build_dir
  • Build
./configure --allow-fetch
make -j 4

Note: make -j 4 will execute up to 4 build tasks in parallel. This number may be increased or decreased as necessary to match the resources available on the machine.

1.3) Install RethinkDB

sudo make install

1.4) Start RethinkDB server

rethinkdb --bind all

Step 2: Testing (Optional)

2.1) Execute Unit Tests

cd $SOURCE_ROOT/rethinkdb
make -j 4 DEBUG=1
./test/run unit -j 4

Note: ./test/run unit -j 4 will execute up to 4 unit tests in parallel. This number may be increased or decreased to match the resources available on the machine. A test case:UtilsTest may be failed if the local Time Zone is not defined.

2.2) Execute Integration Tests

cd $SOURCE_ROOT/rethinkdb
./test/run -j 4

Note: 2 cases: regression.known_failures_1774 and cpplint.cpplint are known failed cases that are also found on x86_64 platform. They can be safely ignored.

Reference

https://www.rethinkdb.com/

Clone this wiki locally