Skip to content
salamani edited this page Sep 9, 2016 · 4 revisions

#Building Couchdb Below versions of Couchdb are available in respective distributions at the time of this recipe creation:

  • Ubuntu 16.04 has 1.6.0

The instructions provided below specify the steps to build Couchdb Version 1.6.1 on Linux on the IBM z Systems for RHEL 6/7, SLES 11/12 and Ubuntu 16.04.

General Note:

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

Building and Installing Couchdb

  1. First, install the build-time dependencies:

    On SLES 11:

        sudo zypper install libicu-devel libcurl-devel git wget autoconf213 zip fontconfig-devel pkg-config yasm tar make gtk2-devel libidl-devel  dbus-1-devel dbus-1-glib-devel libnotify-devel java-1_7_0-ibm  libopenssl-devel libssh-devel ncurses-devel unixODBC unixODBC-devel libtool pkg-config
    

    On SLES 12:

      sudo zypper install libicu-devel libcurl4 libcurl-devel git wget mozilla-nspr mozilla-nspr-devel autoconf213 zip fontconfig fontconfig-devel pkg-config libasound2 yasm tar make gtk2-devel libXt-devel libIDL-2-0 libidl-devel libfreetype6 libgstreamer-1_0-0 dbus-1-devel dbus-1-glib-devel libnotify4 libnotify-devel python wget perl perl-base java-1_7_1-ibm java-1_7_1-ibm-devel libopenssl-devel libssh-devel ncurses-devel unixODBC unixODBC-devel libtool pkg-config
    

    On RHEL 6.6:

      sudo yum install libicu-devel libcurl libcurl-devel git wget zip bzip2 tar nspr nspr-devel autoconf213 fontconfig fontconfig-devel pkgconfig make gtk2-devel libXt-devel libIDL libIDL-devel freetype freetype-devel gstreamer gstreamer-devel dbus dbus-devel dbus-glib dbus-glib-devel libnotify libnotify-devel python perl java-1.7.1-ibm java-1.7.1-ibm-devel xz libtool perl-CPAN
    
  
 On RHEL 7.1:
  ```
  sudo yum install libicu-devel libcurl libcurl-devel git wget zip bzip2 tar nspr nspr-devel autoconf213 fontconfig fontconfig-devel pkgconfig make gtk2-devel libXt-devel libIDL libIDL-devel freetype freetype-devel gstreamer1 gstreamer1-devel dbus dbus-devel dbus-glib dbus-glib-devel libnotify libnotify-devel python perl java-1.7.1-ibm java-1.7.1-ibm-devel xz libtool which texlive.s390x texlive-titlesec.noarch texlive-framed.noarch texlive-threeparttable.noarch texlive-wrapfig.noarch texlive-multirow.noarch texinfo.s390x
  1. Now install gcc-c++ and dependencies(latex) for doc generation

    On SLES 11:

        sudo zypper install gcc47-c++
        sudo ln -s /usr/bin/gcc-4.7 /usr/bin/gcc
        sudo ln -s /usr/bin/gcc-4.7 /usr/bin/cc
        sudo ln -s /usr/bin/g++-4.7 /usr/bin/g++
        sudo ln -s /usr/bin/g++-4.7 /usr/bin/c++
    

    On SLES 12.0:

        sudo zypper install gcc-c++
    

    On RHEL 6.6 & 7.1:

       sudo yum install gcc-c++
    
  2. Installing SpiderMonkey

    i) Obtain the SpiderMonkey source code

     cd /<source_root>/
     wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
    

    ii). Untar the archive and change working directory:

     tar zxf js185-1.0.0.tar.gz && cd js-1.8.5/js/src
    

    iii). Effect the following source code changes

    NOTE: The given line numbers account for any previous action on the file.

     Edit file /<source_root>/js-1.8.5/js/src/jsval.h
     Remove line 309 ( content: 'jsuword        word;' )
     Add a new line after line number 312 and insert the following string:
         jsuword        asWord;
     Add a new line after line number 322 and insert the following string:
         uint32         padding;
     Add a new line after line number 346 and insert the following string:
         uint32         padding;
     Add a new line after line number 355 and insert the following string:
         jsuword        asWord;
    

Save the file.

_For more info on the above see the [bugzilla diff](

http://hg.mozilla.org/mozilla-central/rev/6f2c0dbb88d3)_

    Edit file /<source_root>/js-1.8.5/js/src/jsvalue.h
    Remove line 294 ( content: 'JS_STATIC_ASSERT(offsetof(jsval_layout, s.payload) == 0);' )
    Replace line 731 ( content: 'return &data.s.payload.word;' )
    with the following content:
        #if JS_BITS_PER_WORD == 32
            return reinterpret_cast<const jsuword *>(&data.s.payload.word);
        #elif JS_BITS_PER_WORD == 64
            return reinterpret_cast<const jsuword *>(&data.asBits);
        #endif
Save the file.

_For more info on the above see the [bugzilla diff](

https://bugzilla.mozilla.org/attachment.cgi?id=517107&action=diff)_

    Edit file /<source_root>/js-1.8.5/js/src/Makefile.in
    Change line number 385:
        From: ifeq (,$(filter-out powerpc sparc,$(TARGET_CPU)))
        To:   ifeq (,$(filter arm %86 x86_64,$(TARGET_CPU)))
Save the file.

_For more info on the above see the [bugzilla diff](https://bugzilla.mozilla.org/attachment.cgi?id=520157&action=diff)_

iv) Prepare the src code using autoconf

    autoconf-2.13

v) Create a workspace directory and cd into it

    mkdir /<source_root>/js-1.8.5/js/src/build_OPT.OBJ
    cd /<source_root>/js-1.8.5/js/src/build_OPT.OBJ

vi) Run the Configure step

    ./configure --prefix=/usr

vii) Go ahead and make SpiderMonkey

    make

viii) If no error is found, install SpiderMonkey:

    sudo make install
  1. Install Erlang:

NOTE: Steps 1 & 2 within the following Erlang instruction links should be ignored ( as we have already covered those steps earlier in this recipe ).

  cd /<source_root>/
  1. Install Nodejs

        cd /<source_root>/
        git clone https://github.com/andrewlow/node.git 
        cd /<source_root>/node 
        git checkout v0.10.38-release-ppc
        ./configure
        make
        sudo make install
    
  2. Install Rebar

    i) CouchDB requires rebar Build it from source by running:

     cd /<source_root>/
     git clone git://github.com/rebar/rebar.git
     cd /<source_root>/rebar
     ./bootstrap
    

    ii) The bootstrap command produces an Erlang escript named rebar. Copy it into a directory in your $PATH:

     sudo cp /<source_root>/rebar/rebar /usr/local/bin/
    
  3. Install Autoconf-archive

     wget http://infinity.kmeacollege.ac.in/gnu/autoconf-archive/autoconf-archive-2016.03.20.tar.xz
     tar -xvf autoconf-archive-2016.03.20.tar.xz
     cd autoconf-archive-2016.03.20
     ./configure
     make
     sudo make install
     sudo cp ./m4/* /usr/share/aclocal (Only for RHEL)
    
  4. Install "prove" module using CPAN (Only for RHEL6)

     /usr/bin/perl -MCPAN -e 'prove'
    
  5. Now set up the CouchDB source tree:

     cd /<source_root>/
     git clone https://git-wip-us.apache.org/repos/asf/couchdb.git
     cd /<source_root>/couchdb
     git checkout 1.6.1
    
  6. Configure the source tree (which will fetch more source code from version control), then run make to build CouchDB:

    ./bootstrap
    ./configure --prefix=/opt/couchdb
    export LD_LIBRARY_PATH=/usr/lib
    make		
    
  7. Installing couchdb

     sudo make install
    
  8. Now make and run some sanity tests.

    make check
    
  9. Generate an installable release with an embedded Erlang run-time system

    make dist
    
  10. Verify Couchdb by starting the server:

     cd /opt/couchdb/bin
     sudo ./couchdb &
    

    curl http://127.0.0.1:5984/ should display

    {"couchdb":"Welcome","uuid"="xxx","version":"1.6.1","vendor":{"name":"The Apache Software Foundation"}}
    
Clone this wiki locally