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

Building CouchDB

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

  • RHEL (8.10, 9.6, 9.8, 10.0, 10.2)
  • 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.3/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 PACKAGE_VERSION="3.5.3"
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/CouchDB/${PACKAGE_VERSION}/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.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
    
  • RHEL (10.0, 10.2)
    sudo yum install -y openssl openssl-devel libicu-devel gcc-c++ pkg-config libtool help2man python3 python3-devel python3-pip git curl diffutils perl-Test-Harness procps-ng
    
  • 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 python3-venv git curl libmozjs-115-dev
    

2.2 Install Erlang

export ERLANG_VERSION="28.5"
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.20.1"
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="v24.21.0"
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
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}}
curl -fsSL "${PATCH_URL}/couchdb353-test-fixes.patch" | git apply -
git diff --check
export SPIDERMONKEY_VERSION=60 #Only for RHEL 8.10
export SPIDERMONKEY_VERSION=78 #Only for RHEL 9.x
export SPIDERMONKEY_VERSION=115 #Only for Ubuntu 22.04 and Ubuntu 24.04
./configure --spidermonkey-version ${SPIDERMONKEY_VERSION}

# For RHEL 10.0 and RHEL 10.2, use this instead:
./configure --disable-spidermonkey --js-engine=quickjs
make release

4. Testing (Optional)

cd "${SOURCE_ROOT}"/couchdb
DFLTCC=0 make check

Note:

References: