Skip to content

Building RethinkDB

aborkar-ibm edited this page Nov 2, 2021 · 23 revisions

Building RethinkDB

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

  • RHEL (7.8, 7.9, 8.1, 8.2, 8.3)
  • SLES (12 SP5, 15 SP1, 15 SP2)
  • Ubuntu (18.04, 20.04, 20.10)

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 using script

If you want to build RethinkDB using manual steps, go to STEP 2.

Use the following commands to build RethinkDB using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/RethinkDB/2.4.1/build_rethinkdb.sh

# Build Spark
bash build_rethinkdb.sh   [Provide -h option to print help menu]

If the build completes successfully, go to STEP 3. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.

Step 2: Build and Install RethinkDB

export SOURCE_ROOT=/<source_root>/

2.1) Install the Dependencies

  • RHEL (7.8, 7.9)
  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, 8.3)
  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 protobuf-devel protobuf-compiler
  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=2.6.1-7.3.16 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 libopenssl-devel zlib-devel wget tar patch curl unzip autoconf automake libtool  libicu-devel protobuf-devel libprotobuf-c-devel boost-devel termcap curl libcurl-devel git bzip2 awk gzip xz readline-devel sqlite3-devel tk-devel ncurses-devel gdbm-devel libdb-4_8-devel gdb 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, 8.2 and 8.3)
  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
  • 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	

2.2) Clone and build RethinkDB

export VPYTHON_BYPASS="manually managed python not supported by chrome operations"
cd $SOURCE_ROOT
git clone https://github.com/rethinkdb/rethinkdb
cd rethinkdb
git checkout v2.4.1
  • Apply the patches in mk/support/pkg/v8.sh
export PATCH_URL=https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/RethinkDB/2.4.1/patch
# For RHEL
curl -o v8_rhel.patch $PATCH_URL/v8_rhel.patch 
patch mk/support/pkg/v8.sh v8_rhel.patch
# For SLES
curl -o v8_sles.patch $PATCH_URL/v8_sles.patch
patch mk/support/pkg/v8.sh v8_sles.patch
# For Ubuntu
curl -o v8_ubuntu.patch $PATCH_URL/v8_ubuntu.patch
patch mk/support/pkg/v8.sh v8_ubuntu.patch
  • 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.

2.3) Install RethinkDB

sudo make install

2.4) Start RethinkDB server

rethinkdb --bind all

Step 3: Testing (Optional)

3.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.

3.2) Execute Integration Tests

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

Note: Test case: regression.known_failures_1774 is a known failure found on x86_64 platform as well. It can be safely ignored.

Reference

https://www.rethinkdb.com/

Clone this wiki locally