Skip to content

Building Couchbase

aborkar-ibm edited this page Mar 5, 2019 · 21 revisions

Building Couchbase

The instructions provided below specify the steps to build Couchbase version 5.1.0 on Linux on IBM Z for following distributions:

  • RHEL (6.9, 7.3, 7.4, 7.5)
  • SLES (11 SP4, 12 SP3)
  • Ubuntu (16.04, 18.04)

General Notes:

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

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

Step 1 : Install the Dependencies

  • RHEL 6.9

    sudo yum install autoconf automake bzip2 bzip2-devel check-devel cmake curl expat-devel gcc gcc-c++ gettext-devel git java-1.7.1-ibm java-1.7.1-ibm-devel libcurl-devel libevent-devel libtool libxml2-devel libxslt-devel make ncurses-devel openssl-devel patch perl-devel pkgconfig openssl ruby-devel snappy-devel sqlite-devel subversion tar unixODBC unixODBC-devel vim wget xz xz-devel zlib-devel xinetd
    
  • RHEL (7.3, 7.4, 7.5)

    sudo yum install autoconf automake bzip2-devel check-devel cmake curl flex gcc-c++ git java-1.7.1-ibm java-1.7.1-ibm-devel libcurl-devel libevent-devel libtool libxml2-devel libxslt-devel make ncurses-devel openssl openssl-devel pkgconfig snappy-devel sqlite-devel subversion tar unixODBC unixODBC-devel vim wget xinetd
    
  • SLES 11 SP4

    sudo zypper install autoconf automake bzip2 check-devel compat curl-openssl1 flex gawk gcc gcc-c++ gcc-z9 gcc48-c++ git java-1_7_1-ibm-devel libaio-devel libbz2-devel libcurl-devel libglib-2_0-0 libopenssl-devel libtool lksctp-tools-devel make m4 ncurses-devel openssl patch pkg-config python-devel python-xml sqlite3-devel subversion tar unixODBC unixODBC-devel vim wget-openssl1 xz zip zlib-devel xinetd
    export CC=/usr/bin/gcc-4.8
    export CXX=/usr/bin/g++-4.8
    

    Perform following step to resolve git connectivity issue:

    git config --global url."git://github.com/".insteadOf "https://github.com/"
    
  • SLES 12 SP3

    sudo zypper install autoconf automake bzip2 check-devel cmake compat curl flex gcc gcc-c++ git java-1_7_1-ibm-devel libaio-devel libbz2-devel libcloog-isl4 libcurl-devel libevent-devel libglib-2_0-0 libmozjs-17_0 libopenssl-devel libstdc++-devel libtool libxml2-tools libxslt-tools lksctp-tools-devel make m4 ncurses-devel openssl patch pkg-config python-devel python-pyOpenSSL python-xml ruby2.1 snappy-devel sqlite3-devel subversion tar unixODBC unixODBC-devel vim wget which xz xz-devel zip zlib-devel xinetd
    
  • Ubuntu 16.04

    sudo apt-get update && sudo apt-get install autoconf automake check cmake curl flex gcc-4.8 git g++-4.8 libcurl4-openssl-dev libevent-dev libglib2.0-dev libncurses5-dev libsnappy-dev libssl-dev libtool libxml2-utils make openssl pkg-config python python-dev ruby sqlite3 subversion tar unixodbc unixodbc-dev vim wget xsltproc golang-1.9 xinetd
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 40  
    export PATH=/usr/lib/go-1.9/bin:$PATH  
    
  • Ubuntu 18.04

    sudo apt-get update && sudo apt-get install autoconf automake gcc-5 g++-5 check cmake curl flex git libevent-dev libglib2.0-dev libncurses5-dev libsnappy-dev libtool libxml2-utils make pkg-config python python-dev ruby sqlite3 subversion tar unixodbc unixodbc-dev vim wget xsltproc golang-1.9 xinetd libcurl4-gnutls-dev libssl1.0-dev
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 40
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 40
    export PATH=/usr/lib/go-1.9/bin:$PATH  
    
  • Install Java ( Ubuntu 16.04 and 18.04 Only )

    cd /<source_root>/
    Download the Java SDK 8 Installable package for Linux on z Systems 64-bit from [here](https://developer.ibm.com/javasdk/downloads/#tab_sdk8) and use the command below to install java  
    
    chmod +x ibm-java-s390x-sdk-8.0-5.27.bin 
    sudo ./ibm-java-s390x-sdk-8.0-5.27.bin	
    export JAVA_HOME=<path_to_java_installation_directory>
    export PATH=$JAVA_HOME/bin:$PATH  
    
  • For RHEL 6.9 and SLES 11 SP4, install following additional dependencies:

    • gcc(4.8.5) - RHEL 6.9

       cd /<source_root>/
       wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz
       tar -xzf gcc-4.8.5.tar.gz && cd gcc-4.8.5
       ./contrib/download_prerequisites
       mkdir build && cd build/
       ../configure --disable-multilib --disable-checking --enable-languages=c,c++ --enable-multiarch --enable-shared --enable-threads=posix --without-included-gettext --with-system-zlib --prefix=/usr/local
       make && sudo make install
       export CC=/usr/local/bin/s390x-ibm-linux-gnu-gcc
       export CXX=/usr/local/bin/s390x-ibm-linux-gnu-g++
       export LD_LIBRARY_PATH=/usr/local/lib64/:/usr/local/lib/:$LD_LIBRARY_PATH
       sudo /sbin/ldconfig  
       gcc --version
    • git(2.0.0) - RHEL 6.9

       cd /<source_root>/
       wget https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.gz  
       tar -xzf git-2.0.0.tar.gz && cd git-2.0.0
       ./configure --prefix=/usr/local && make && sudo make install
       git --version
    • flex - RHEL 6.9

       sudo yum install -y flex
    • snappy(1.1.1) - SLES 11 SP4

       cd /<source_root>/
       git clone https://github.com/couchbasedeps/snappy.git
       cd snappy && git checkout 1.1.1
       ./configure --prefix=/usr/local --enable-shared --disable-static --disable-dependency-tracking --disable-gtest
       make && sudo make install
    • Libevent (2.0.9) - (RHEL 6.9, SLES 11 SP4)

      cd /<source_root>/
      git clone https://github.com/couchbasedeps/libevent.git
      cd libevent && git checkout release-2.0.9-rc
      ACLOCAL="aclocal -I /usr/share/aclocal" autoreconf -if
      ./autogen.sh && ./configure && make && sudo make install
      sudo cp /usr/local/lib/libevent*  /usr/local/lib64 	      (For RHEL 6.9)  

Other dependencies

  • Go (For RHEL & SLES)

    cd /<source_root>/
    wget https://storage.googleapis.com/golang/go1.10.1.linux-s390x.tar.gz
    chmod ugo+r go1.10.1.linux-s390x.tar.gz
    sudo tar -C /usr/local -xzf go1.10.1.linux-s390x.tar.gz
    export PATH=$PATH:/usr/local/go/bin
    
    sudo ln /usr/bin/gcc-4.8 /usr/bin/s390x-linux-gnu-gcc (SLES 11 SP4 only)
    sudo ln /usr/local/bin/s390x-ibm-linux-gnu-gcc /usr/bin/s390x-linux-gnu-gcc (RHEL 6.9 only)
    sudo ln /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc (RHEL (7.3, 7.4, 7.5), SLES 12 SP3, Ubuntu) 
  • Python 2.7.12 (For RHEL and SLES)

    cd /<source_root>/
    wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
    tar -xf Python-2.7.12.tar.xz
    cd Python-2.7.12
    ./configure --prefix=/usr/local
    make && sudo make install
    sudo mv /usr/bin/python /usr/bin/python_old
    sudo ln -sf /usr/local/bin/python /usr/bin/
    python -V

    Note: python -V should show 2.7.12.

  • CMake 3.5.2 (For RHEL and SLES)

    sudo ln -sf /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6  (For RHEL 6.9 only)
    
    cd /<source_root>/
    wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
    tar -xzf cmake-3.5.2.tar.gz
    cd cmake-3.5.2
    ./configure --prefix=/usr/local
    make && sudo make install
  • Openssl (Ubuntu 18.04 only)

    cd /<source_root>/
    wget https://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2h.tar.gz
    tar zxf openssl-1.0.2h.tar.gz
    cd openssl-1.0.2h
    ./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared zlib-dynamic
    make
    sudo make install
    
  • json

    cd /<source_root>/
    git clone https://github.com/nlohmann/json
    cd json
    export PATH=$PATH:`pwd`
  • Boost 1.66.0

    cd /<source_root>/
    wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
    tar -xvzf boost_1_66_0.tar.gz 
    sudo ln -s <source_root>/boost_1_66_0/boost /usr/include/boost
  • Erlang couchbase-watson

    cd /<source_root>/
    git clone https://github.com/couchbasedeps/erlang.git
    cd erlang && git checkout couchbase-watson
    ./otp_build autoconf
    touch lib/debugger/SKIP lib/megaco/SKIP lib/observer/SKIP lib/wx/SKIP
    ./configure --prefix=/usr/local --enable-smp-support --disable-hipe --disable-fp-exceptions CFLAGS="-fno-strict-aliasing -O3 -ggdb3 -DOPENSSL_NO_EC=1"
    make -j$(cat /proc/cpuinfo | grep processor | wc -l) && sudo make install
  • Flatbuffers

    • Download the source code
    cd /<source_root>/
    git clone https://github.com/google/flatbuffers
    cd flatbuffers && git checkout v1.5.0
    • Edit the file include/flatbuffers/flatbuffers.h
    @@ -69,6 +69,7 @@
    
    // The wire format uses a little endian encoding (since that's efficient for
    // the common platforms).
    +#define FLATBUFFERS_LITTLEENDIAN 0
    #if !defined(FLATBUFFERS_LITTLEENDIAN)
    #if defined(__GNUC__) || defined(__clang__)
    #ifdef __BIG_ENDIAN__
    • Install Flatbuffers
    cmake -G "Unix Makefiles"
    make && export PATH=$PATH:`pwd`
    sudo make install
  • ICU 54.1

    cd /<source_root>/
    git clone https://github.com/couchbasedeps/icu4c.git
    cd icu4c/source && git checkout r54.1
    ./configure --prefix=/usr/local --disable-extras --disable-layout --disable-tests --disable-samples
    make && sudo make install
    • For RHEL/SLES

       sudo cp /usr/local/lib/libicu*  /usr/local/lib64
      
  • Jemalloc 4.3.1

    cd /<source_root>/
    git clone https://github.com/couchbasedeps/jemalloc.git
    cd jemalloc && git checkout 4.3.1
    autoconf configure.ac > configure
    chmod u+x configure
    CPPFLAGS=-I/usr/local/include ./configure --prefix=/usr/local --with-jemalloc-prefix=je_ --disable-cache-oblivious --disable-zone-allocator --enable-prof
    make build_lib_shared
    sudo make install_lib_shared install_include
  • To install V8 5.2-couchbase libraries, follow the steps given below:

    cd /<source_root>/
    git clone https://github.com/couchbasedeps/v8.git
    cd v8 && git checkout 5.2-couchbase
  • Edit the following file for Ubuntu (16.04 and 18.04) only

    1. /<source_root>/v8/test/cctest/interpreter/generate-bytecode-expectations.cc

      @@ -174,15 +174,14 @@ bool CollectGoldenFiles(std::vector<std::string>* golden_file_list,
      DIR* directory = opendir(directory_path);
      if (!directory) return false;
      
      -  dirent entry_buffer;
      -  dirent* entry;
      -
      -  while (readdir_r(directory, &entry_buffer, &entry) == 0 && entry) {
      +  dirent* entry = readdir(directory);
      +  while (entry) {
           if (StrEndsWith(entry->d_name, ".golden")) {
             std::string golden_filename(kGoldenFilesPath);
             golden_filename += entry->d_name;
             golden_file_list->push_back(golden_filename);
           }
      +    entry = readdir(directory);
         }
  • Follow the steps given below:

    make -j$(cat /proc/cpuinfo | grep processor | wc -l) s390x.release GYPFLAGS+="-Dcomponent=shared_library -Dv8_enable_backtrace=1 -Dv8_use_snapshot='true' -Dclang=0 -Dv8_use_external_startup_data=0 -Dv8_enable_i18n_support=0 -Dtest_isolation_mode=noop" PYTHONPATH=`pwd`/third_party/argparse-1.4.0 (For RHEL, SLES 12 SP3, and Ubuntu only)
    make -j$(cat /proc/cpuinfo | grep processor | wc -l) s390x.release GYPFLAGS+="-Dcomponent=shared_library -Dv8_enable_backtrace=1 -Dv8_use_snapshot='true' -Dclang=0 -Dv8_use_external_startup_data=0 -Dv8_enable_i18n_support=0 -Dtest_isolation_mode=noop" CC_host=/usr/bin/gcc-4.8 CXX_host=/usr/bin/g++-4.8 PYTHONPATH=`pwd`/third_party/argparse-1.4.0 (For SLES 11 SP4 only)
    sudo cp -vR include/* /usr/local/include/
    sudo chmod 644 /usr/local/include/libplatform/libplatform.h
    sudo chmod 644 /usr/local/include/v8*h
    • For RHEL/SLES

       sudo cp -v out/s390x.release/lib.target/libv8.so /usr/local/lib64/
       sudo chmod -f 755 /usr/local/lib64/libv8.so
      
    • For Ubuntu

       sudo cp -v out/s390x.release/lib.target/libv8.so /usr/local/lib/
       sudo chmod -f 755 /usr/local/lib/libv8.so
      

Step 2 : Download the Repo tool

  • Download the Repo tool using cURL tool and ensure that it has execute permissions

    cd /<source_root>/
    curl https://storage.googleapis.com/git-repo-downloads/repo > repo
    chmod a+x repo

Step 3 : Build, install and test Couchbase

  • Create a directory couchbase

    mkdir -p /<source_root>/couchbase
  • Clone the Couchbase 5.1.0 release using the the manifest file via Repo tool with the init and sync commands

    cd /<source_root>/couchbase
    git config --global user.email your@email.addr
    git config --global user.name  your_name
    ../repo init -u git://github.com/couchbase/manifest -m released/5.1.0.xml
    ../repo sync
  • Edit the following files

    1. /<source_root>/couchbase/tlm/CMakeLists.txt

      @@ -69,7 +69,7 @@ SET(COUCHBASE_SERVER_BUILD True CACHE BOOL "Indicating this is a server build")
      
      # Try to download the prebuilt 3rd-party dependencies by default
      IF (NOT DEFINED CB_DOWNLOAD_DEPS)
      -   SET(CB_DOWNLOAD_DEPS True
      +   SET(CB_DOWNLOAD_DEPS False 
      CACHE BOOL "Download prebuilt dependencies by default")
      ENDIF (NOT DEFINED CB_DOWNLOAD_DEPS)
      
      @@ -110,7 +110,7 @@ INCLUDE(FindCouchbasePythonInterp)
      INCLUDE(FindCouchbaseErlang)
      INCLUDE(FindCouchbaseDtrace)
      INCLUDE(FindCouchbaseGo)
      - INCLUDE(FindCouchbaseBreakpad)
      + #INCLUDE(FindCouchbaseBreakpad)
      INCLUDE(FindCouchbaseFlatbuffers)
      INCLUDE(FindCouchbaseValgrind)
      INCLUDE(CouchbaseCompilerOptions)
    2. /<source_root>/couchbase/forestdb/src/arch.h

      @@ -316,6 +316,10 @@
      #define spin_unlock(arg) pthread_spin_unlock(arg)
      #define spin_destroy(arg) pthread_spin_destroy(arg)
      #define SPIN_INITIALIZER (spin_t)(1)
      +     #if defined(__s390x__)
      +        #undef SPIN_INITIALIZER
      +        #define SPIN_INITIALIZER (spin_t)(0)
      +     #endif
      #endif
      #ifndef mutex_t
      // mutex
    3. /<source_root>/couchbase/couchstore/src/views/bin/couch_view_file_merger.cc

      @@ -37,8 +37,7 @@ typedef enum {
          MERGE_FILE_TYPE_ID_BTREE = 'i',
      	MERGE_FILE_TYPE_MAPREDUCE_VIEW = 'v',
      	MERGE_FILE_TYPE_SPATIAL = 's'
      -} merge_file_type_t;
      +}; typedef unsigned char merge_file_type_t;
    4. /<source_root>/couchbase/forestdb/utils/debug.cc

      @@ -89,6 +89,8 @@ static void sigsegv_handler(int sig, siginfo_t *siginfo, void *context)
      ucontext *u = (ucontext *)context;
      #ifdef REG_RIP // Test if the Program Counter is 64 bits
      	unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_RIP];
      + #elif __s390x__
      +    unsigned char *pc = (unsigned char *)u->uc_mcontext.psw.addr;
      #else // 32 bit machine, PC is stored in %eip register
      	unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_EIP];
      #endif // REG_RIP for 64-bit machines
    5. /<source_root>/couchbase/platform/CMakeLists.txt

      @@ -165,7 +165,6 @@ ADD_LIBRARY(platform_so SHARED ${PLATFORM_FILES}
                           src/cbassert.c
                           src/checked_snprintf.cc
                           src/crc32c.cc
      - 		     src/crc32c_sse4_2.cc
                           src/crc32c_private.h
                           src/global_new_replacement.cc
                           src/processclock.cc
    6. /<source_root>/couchbase/platform/include/platform/crc32c.h

      @@ -39,7 +39,7 @@
       // To fix will require refactoring to hide the X86 dependencies when
       // built on another platform.
       //
      -#if !defined(__x86_64__) && !defined(_M_X64) && !defined(_M_IX86)
      +#if !defined(__x86_64__) && !defined(_M_X64) && !defined(_M_IX86) && !defined(__s390x__)
       #error "crc32c requires X86 SSE4.2 for hardware acceleration"
       #endif
    7. /<source_root>/couchbase/platform/src/crc32c.cc

      @@ -52,6 +52,7 @@
       //
      
       #include "platform/crc32c.h"
      +#include <crc32-s390x.h>
       #include "crc32c_private.h"
      
       #include <stdint.h>
      @@ -60,7 +61,7 @@
       // select header file for cpuid.
       #if defined(WIN32)
       #include <intrin.h>
      -#elif defined(__clang__) || defined(__GNUC__)
      +#elif defined(__clang__) || defined(__GNUC__) && !defined(__s390x__)
       #include <cpuid.h>
       #endif
      
      @@ -368,10 +369,10 @@ extern uint32_t crc32c_hw(const uint8_t* buf, size_t len, uint32_t crc_in);
       // If SSE4.2 is available then hardware acceleration is used.
       //
       crc32c_function setup_crc32c() {
      -    const uint32_t SSE42 = 0x00100000;
      +//    const uint32_t SSE42 = 0x00100000;
      
      	 crc32c_function f = crc32c_sw;
      -
      +/*
       #if defined(WIN32)
      	 std::array<int, 4> registers = {{0,0,0,0}};
      	 __cpuid(registers.data(), 1);
      @@ -383,7 +384,7 @@ crc32c_function setup_crc32c() {
      	 if (registers[2] & SSE42) {
      		 f = crc32c_hw;
      	 }
      -
      +*/
      	 return f;
       }
    8. /<source_root>/couchbase/platform/tests/CMakeLists.txt

      @@ -7,7 +7,7 @@ ADD_SUBDIRECTORY(base64)
      ADD_SUBDIRECTORY(biset)
      ADD_SUBDIRECTORY(checked_snprintf)
      ADD_SUBDIRECTORY(cjson)
      - ADD_SUBDIRECTORY(crc32)
      + #ADD_SUBDIRECTORY(crc32)
      ADD_SUBDIRECTORY(dirutils)
      ADD_SUBDIRECTORY(gethrtime)
      ADD_SUBDIRECTORY(gettimeofday)
    9. /<source_root>/couchbase/goproj/src/github.com/couchbase/indexing/secondary/memdb/skiplist/skiplist.go

      @@ -74,12 +74,13 @@ func NewWithConfig(cfg Config) *Skiplist {
      		}
      
      		if cfg.UseMemoryMgmt {
      -               s.freeNode = func(n *Node) {
      -                       if Debug {
      -                               debugMarkFree(n)
      -                       }
      -                       cfg.Free(unsafe.Pointer(n))
      -               }
      +                s.freeNode = func(*Node) {}
      +       //      s.freeNode = func(n *Node) {
      +       //              if Debug {
      +       //                      debugMarkFree(n)
      +       //              }
      +       //              cfg.Free(unsafe.Pointer(n))
      +       //      }
      		} else {
      				s.freeNode = func(*Node) {}
      		}
    10. /<source_root>/couchbase/kv_engine/daemon/subdocument_validators.cc

      @@ -424,7 +424,7 @@ static protocol_binary_response_status subdoc_multi_validator(const Cookie& cook
      
      	 if ((req->request.magic != PROTOCOL_BINARY_REQ) ||
      		 (req->request.keylen == 0) ||
      -        (req->request.bodylen < minimum_body_len) ||
      +        (htonl(__bswap_32(req->request.bodylen)) < minimum_body_len) ||
      		 (req->request.datatype != PROTOCOL_BINARY_RAW_BYTES)) {
      		 return PROTOCOL_BINARY_RESPONSE_EINVAL;
      	 }
    11. /<source_root>/couchbase/benchmark/src/cycleclock.h

      @@ -82,6 +82,10 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
      uint64_t low, high;
      __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
      return (high << 32) | low;
      +#elif defined(__s390x__)
      +  uint64_t res;
      +  __asm__ volatile("stck %0" : "=m"(res));
      +  return res;
       #elif defined(__powerpc__) || defined(__ppc__)
         // This returns a time-base, which is not always precisely a cycle-count.
         int64_t tbl, tbu0, tbu1;
    12. /<source_root>/couchbase/platform/include/platform/cacheline_padded.h

      @@ -20,7 +20,7 @@
       // expect this to be a single cache line (64B on x86-64), but on
       // Sandybridge (at least) it has been observed that pairs of
       // cachelines can interfere with each other.
      -#define FALSE_SHARING_RANGE 128
      +#define FALSE_SHARING_RANGE 64
      
       namespace cb {
    13. /<source_root>/couchbase/kv_engine/engines/ep/src/ep_engine.cc

      @@ -3675,7 +3675,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::observe(
      			 int(key.size()), key.data(), vb_id);
      
      		 // Get key stats
      -        uint16_t keystatus = 0;
      +        uint8_t keystatus = 0;
      		 struct key_stats kstats;
      		 memset(&kstats, 0, sizeof(key_stats));
      		 ENGINE_ERROR_CODE rv = kvBucket->getKeyStats(
    14. /<source_root>/couchbase/kv_engine/engines/ep/tests/ep_testsuite_xdcr.cc (For Ubuntu 16.04 and 18.04 only)

      @@ -2359,7 +2359,7 @@ static enum test_result test_cas_options_and_nmeta(ENGINE_HANDLE *h,
      	 itemMeta.flags = 0xdeadbeef;
      
      	 // Watson (4.6) accepts valid encodings, but ignores them
      -    std::vector<char> junkMeta = {-2,-1,2,3};
      +    std::vector<char> junkMeta = {char(-2),char(-1),2,3};
      
      int force = 0;
    15. /<source_root>/couchbase/tlm/cmake/Modules/FindCouchbaseLibevent.cmake (For Ubuntu 16.04 only)

      @@ -45,8 +44,11 @@ macro(get_directory _dirname filename)
      	 get_filename_component(${_dirname} ${resolved} DIRECTORY)
         endif ()
       endmacro(get_directory _dirname filename)
      -
      +set(LIBEVENT_INCLUDE_DIR /usr/include)
      +set(LIBEVENT_EXTRA_LIB /usr/lib/s390x-linux-gnu/libevent_extra.so)
      +set(LIBEVENT_CORE_LIB /usr/lib/s390x-linux-gnu/libevent_core.so)
      +set(LIBEVENT_THREAD_LIB /usr/lib/s390x-linux-gnu/libevent_pthreads.so)
       set(_libevent_exploded ${CMAKE_BINARY_DIR}/tlm/deps/libevent.exploded)
  • Replace Boltdb package

    cd ./godeps/src/github.com/
    mv boltdb boltdb_ORIG
    mkdir boltdb
    cd boltdb
    git clone https://github.com/boltdb/bolt.git
    cd bolt/
    git checkout v1.3.0
  • Add the s390x crc32 support to the source code.

    cd /<source_root>/
    git clone https://github.com/linux-on-ibm-z/crc32-s390x
    cd crc32-s390x
    export CC=/usr/local/bin/s390x-ibm-linux-gnu-gcc (For RHEL 6.9)
    export CC=/usr/bin/gcc-5 (Ubuntu 16.04, 18.04)
    make && sudo cp crc32-s390x.h /usr/local/include/
    
    • For RHEL/SLES

       sudo cp libcrc32_s390x.a /usr/local/lib64/
      
    • For Ubuntu

       sudo cp libcrc32_s390x.a /usr/local/lib/
      
  • Set environment variables

    export CB_MULTI_GO=0
    export CC=/usr/local/bin/s390x-ibm-linux-gnu-gcc (For RHEL 6.9 only)
    export CC=/usr/bin/gcc-4.8 (For SLES 11 SP4 only)
  • Install go tool yacc

    export GOPATH=$HOME/go
    go get -u golang.org/x/tools/cmd/goyacc
    • RHEL & SLES

      sudo ln -s $GOPATH/bin/goyacc /usr/local/go/pkg/tool/linux_s390x/ 
      sudo ln -sf /usr/local/go/pkg/tool/linux_s390x/goyacc /usr/local/go/pkg/tool/linux_s390x/yacc 
      sudo chmod -f 755 /usr/local/go/pkg/tool/linux_s390x/goyacc          
    • Ubuntu

      sudo cp $HOME/go/bin/goyacc /usr/lib/go-1.9/pkg/tool/linux_s390x/      
      sudo chown root:root /usr/lib/go-1.9/pkg/tool/linux_s390x/goyacc      
      sudo chmod -f 755 /usr/lib/go-1.9/pkg/tool/linux_s390x/goyacc         
      sudo ln -sf /usr/lib/go-1.9/pkg/tool/linux_s390x/goyacc /usr/lib/go-1.9/pkg/tool/linux_s390x/yacc 
  • Run the make command and start the building procedure

    cd /<source_root>/couchbase/
    make

    Note: Sometimes couchbase will automatically install incompatible versions of go on RHEL and SLES. If the build fails with the message: Failed running go install Then run the following commands before restarting the build.

    cd /<source_root>/.cbdepscache/exploded/s390x
    rm -rf .cbdepscache/exploded/s390x
    sudo ln -s /usr/local/go .cbdepscache/exploded/s390x/
    cd /<source_root>/couchbase/
    make clean
  • Run the test cases using ctest tool

    cd /<source_root>/couchbase/build/
    ctest

    Note: As of publishing this recipe, the following errors occur exclusive to s390x. These are only problems with the written test cases, and do not indicate problems in couch-base itself.

    • memcached-timestamp-test: Fails if the user is in a timezone other than EDT
    • couchstore-testapp: Snappy compression creates a slightly smaller output on s390x in this case and though the compression is correct, the test case checks for the size specifically, and fails when it finds an unexpected value.
    • memcached_mcbp_test: The test case leaves garbage data inside of a variable, causing an error once the variable is used.

    Note: These tests fail on s390x, but also fail on x86 and so are not a concern.

    • SLES and RHEL 6.9:

      compact_functional_test
      ep-engine_ep_unit_tests fdb_functional_test
      memcached-auditconfig-test
      memcached-config
      multi_kv_functional_test
      mvcc_functional_test
      platform-dirutils-test

    • Ubuntu and RHEL (7.3, 7.4, 7.5):

      ep-engine_ep_unit_tests
      memcached-auditconfig-test
      memcached-config
      platform-dirutils-test

    Note: Tests from ep_testsuite fail on s390x and investigation is in progress

    ep_testsuite_basic.ephemeral
    ep_testsuite_basic.full_eviction
    ep_testsuite_basic.value_eviction
    ep_testsuite_xdcr.ephemeral
    ep_testsuite_xdcr.full_eviction
    ep_testsuite_xdcr.value_eviction
    ep_testsuite.ephemeral
    ep_testsuite.full_eviction
    ep_testsuite.value_eviction

Step 5 : Start the server

  • Use the below command to start Couchbase Server

    /<source_root>/couchbase/install/bin/couchbase-server -- -noinput &
    

    You can view the Couchbase UI at http://hostname:8091

Reference:

http://www.couchbase.com/nosql-databases/couchbase-server

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.