Building CouchDB - linux-on-ibm-z/docs GitHub Wiki

Building CouchDB

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

  • RHEL (8.10, 9.6, 9.7, 9.8)
  • Ubuntu (22.04, 24.04)

General Note:

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

1. Build using script

If you'd like to build CouchDB using the manual steps, please go to STEP 2.

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/CouchDB/3.5.2/build_couchdb.sh

# Build CouchDB
bash build_couchdb.sh   [Provide -t option for executing build with tests]

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

2. Install Dependencies

export SOURCE_ROOT=/<source_root>/
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/CouchDB/3.5.2/patch"

2.1. Install Basic Dependencies

  • RHEL 8.10
    sudo yum install -y openssl openssl-devel libicu-devel gcc-c++ pkg-config libtool help2man python3.11 python3.11-devel python3.11-pip git mozjs60 mozjs60-devel perl-Test-Harness procps-ng
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 60
    
  • RHEL (9.6, 9.7, 9.8)
    sudo yum install -y openssl openssl-devel libicu-devel gcc-c++ pkg-config libtool help2man python3.11 python3.11-devel python3.11-pip git mozjs78 mozjs78-devel perl-Test-Harness procps-ng
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 60
    
  • Ubuntu (22.04, 24.04)
    sudo apt-get update -y
    sudo apt-get install -y libicu-dev openssl libssl-dev build-essential pkg-config libtool help2man python3 python3-dev python3-pip git libmozjs-102-dev python3-venv
    

2.2 Install Erlang

export ERLANG_VERSION="27.3"
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Erlang/${ERLANG_VERSION}/build_erlang.sh
bash build_erlang.sh -y -j OpenJDK21 

2.3 Install Elixir

cd $SOURCE_ROOT
export ELIXIR_VERSION="v1.17.3"
git clone https://github.com/elixir-lang/elixir.git
cd elixir
git checkout ${ELIXIR_VERSION}
export LANG=C.utf8
export LC_ALL=C.utf8
make -j$(nproc)
sudo make install
elixir -v

2.4 Install Nodejs

cd $SOURCE_ROOT
export NODE_VERSION="v18.20.8"
sudo mkdir -p /usr/local/lib/nodejs
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-s390x.tar.gz
sudo tar xzvf node-${NODE_VERSION}-linux-s390x.tar.gz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-${NODE_VERSION}-linux-s390x/bin:$PATH
node -v
npm -v

3. Download, configure and Install CouchDB

cd $SOURCE_ROOT
export PACKAGE_VERSION="3.5.2"
git clone https://github.com/apache/couchdb.git
cd couchdb
git checkout ${PACKAGE_VERSION}
export LD_LIBRARY_PATH=/usr/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export SPIDERMONKEY_VERSION=60 #Only for RHEL 8.10
export SPIDERMONKEY_VERSION=78 #Only for RHEL 9.x
export SPIDERMONKEY_VERSION=102 #Only for Ubuntu 22.04 and Ubuntu 24.04
./configure --spidermonkey-version ${SPIDERMONKEY_VERSION}
make release

4. Testing (Optional)

cd "${SOURCE_ROOT}"/couchdb
make check

Note:

  • For User Registration, Security, First Run and Running as a Daemon instructions please follow the official documention: https://docs.couchdb.org/en/stable/install/unix.html#installation-from-source

  • couch_btree_prop_tests test related failures can be addressed by re-running tests after changing the timeout value as follows:_

    cd $SOURCE_ROOT/couchdb
    curl -sSL ${PATCH_URL}/couch_btree_prop_tests.patch | git apply -
    
  • couch_cfile_prop_tests test related failures can be addressed by re-running tests after changing the timeout value as follows:_

    cd $SOURCE_ROOT/couchdb
    curl -sSL ${PATCH_URL}/couch_cfile_prop_tests.patch | git apply -
    
  • mango_cursor test related failures can be addressed by re-running tests after changing the timeout value as follows:_

    cd $SOURCE_ROOT/couchdb
    curl -sSL ${PATCH_URL}/mango_cursor.patch | git apply -
    

References: