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

Building InfluxDB

Below version of InfluxDB is available in respective distributions at the time of creation of these build instructions:

  • Ubuntu (22.04, 24.04) have 1.6.7
  • SLES 16 has 1.11.6 and 2.7.10

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

  • RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
  • SLES (15 SP7, 16)
  • Ubuntu (22.04, 24.04)

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.

1. Build using script

If you want to build InfluxDB using manual steps, go to Step 2.

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/InfluxDB/3.10.0/build_influxdb.sh
# Build InfluxDB
bash build_influxdb.sh   [Provide -t option for executing build with tests]

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

2. Install dependencies

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

2.1. Install Basic Dependencies

  • RHEL 8.10

    sudo yum install -y clang git wget curl patch pkg-config python3.12 python3.12-devel python3.12-pip unzip cmake lld ninja-build
    sudo yum install -y gcc-toolset-11 gcc-toolset-11-gcc gcc-toolset-11-gcc-c++ gcc-toolset-11-libatomic-devel gcc-toolset-11-libstdc++-devel
    source /opt/rh/gcc-toolset-11/enable
  • RHEL (9.6, 9.7, 9.8, 10.0, 10.1, 10.2)

    sudo yum install -y clang git wget protobuf protobuf-devel curl patch pkg-config python3 python3-devel cmake diffutils lld ninja-build unzip
  • SLES (15 SP7, 16)

    sudo zypper install -y git wget which protobuf-devel curl patch pkg-config clang gawk make gcc gcc-c++ cmake diffutils lld19 ninja unzip
    
    # Only for SLES 16
    python3 python3-devel python3-pip
    
    # Only for SLES 15 SP7
    python311 python311-devel python311-pip libexpat1
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 60
    sudo zypper install -y gcc15 gcc15-c++
    sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-15 60
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 60
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 60
  • Ubuntu 22.04

    sudo apt-get update
    sudo apt-get install -y build-essential pkg-config libssl-dev curl git protobuf-compiler python3 python3-dev python3-pip python3-venv libprotobuf-dev ninja-build unzip
    sudo apt install -y lsb-release wget software-properties-common gnupg
    wget https://apt.llvm.org/llvm.sh
    chmod +x llvm.sh
    sudo ./llvm.sh 18
    sudo apt install -y lld-18
    sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 \
          --slave /usr/bin/clang++ clang++ /usr/bin/clang++-18
    sudo rm -f /usr/bin/lld
    sudo ln -sf /usr/bin/lld-18 /usr/bin/lld
    sudo ln -sf /usr/bin/ld.lld-18 /usr/bin/ld.lld
  • Ubuntu 24.04

    sudo apt-get update
    sudo apt-get install -y build-essential pkg-config libssl-dev clang curl git protobuf-compiler python3 python3-dev python3-pip python3-venv libprotobuf-dev cmake lld ninja-build unzip

2.2. Install Protobuf (RHEL 8.x only)

cd $SOURCE_ROOT
wget https://github.com/protocolbuffers/protobuf/releases/download/v32.0/protoc-32.0-linux-s390_64.zip
sudo unzip -q protoc-32.0-linux-s390_64.zip -d /usr/local/
rm protoc-32.0-linux-s390_64.zip

2.3. Install CMake (Ubuntu 22.04 only)

cd $SOURCE_ROOT
wget -q https://cmake.org/files/v3.28/cmake-3.28.3.tar.gz
tar -xf cmake-3.28.3.tar.gz
cd cmake-3.28.3
./bootstrap
make -j"$(nproc)"
sudo make install
hash -r
cmake --version
rm $SOURCE_ROOT/cmake-3.28.3.tar.gz

2.4. Install Rust

cd $SOURCE_ROOT
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo install cargo-nextest --locked # If you need to run InfluxDB test suite

3. Build and Install

3.1 Setup Arrow-rs

cd $SOURCE_ROOT
git clone -b 57.3.0 --depth 1  https://github.com/apache/arrow-rs.git
cd arrow-rs
curl -sSL ${PATCH_URL}/arrow.patch | git apply || error "arrow.patch"

3.2 Build datafusion_udf_wasm_python ELF

export IOX_QUERY_UDF_PYTHON_WASM="$SOURCE_ROOT/datafusion-udf-wasm/out/datafusion_udf_wasm_python.release.s390x-unknown-linux-gnu.elf"
cd $SOURCE_ROOT
git clone --recursive -b wasi-sdk-24 --depth 1 https://github.com/webassembly/wasi-sdk
cd wasi-sdk
sed -i '22i #include <cstdint>' src/llvm-project/llvm/include/llvm/ADT/SmallVector.h

cmake -G Ninja -B build/toolchain -S . \
    -DWASI_SDK_BUILD_TOOLCHAIN=ON \
    -DCMAKE_INSTALL_PREFIX=build/install
cmake --build build/toolchain --target install
cmake --build build/toolchain --target dist

cmake -G Ninja -B build/sysroot -S . \
    -DCMAKE_INSTALL_PREFIX=build/install \
    -DCMAKE_TOOLCHAIN_FILE=build/install/share/cmake/wasi-sdk.cmake \
    -DCMAKE_C_COMPILER_WORKS=ON \
    -DCMAKE_CXX_COMPILER_WORKS=ON
cmake --build build/sysroot --target install
cmake --build build/sysroot --target dist
mkdir dist-my-platform
cp build/toolchain/dist/* build/sysroot/dist/* dist-my-platform
./ci/merge-artifacts.sh

cd $SOURCE_ROOT
rustup target add wasm32-wasip2
cargo install --locked cargo-deny
cargo install --locked just
curl -LsSf https://astral.sh/uv/0.9.30/install.sh | sh
if [ -f "$HOME/.local/bin/env" ]; then
    source $HOME/.local/bin/env
fi

cd $SOURCE_ROOT
git clone https://github.com/tombi-toml/tombi.git
cd tombi
cargo build --release
uvx tombi --version

cargo install --locked typos-cli
cargo install --locked wasm-tools

cd $SOURCE_ROOT
git clone https://github.com/influxdata/datafusion-udf-wasm
cd datafusion-udf-wasm
git checkout -b for-influxdb 89ab4ae6312c3a44859ddd43d9df4d4300d3086a
export WASI_SDK_LOCAL_TARBALL="$SOURCE_ROOT/wasi-sdk/build/sysroot/dist/wasi-sysroot-24.0.tar.gz"
just guests::python::build-release

mkdir -p out
cargo run --bin=compile --features="all-arch" --release -- \
    target/wasm32-wasip2/release/datafusion_udf_wasm_python.wasm \
    out/datafusion_udf_wasm_python.release.s390x-unknown-linux-gnu.elf \
    s390x-unknown-linux-gnu

3.3 Build and install InfluxDB

cd $SOURCE_ROOT
git clone --depth 1 -b 3.10.0 https://github.com/influxdata/influxdb.git
cd influxdb
curl -sSL ${PATCH_URL}/influxdb.patch | git apply || error "influxdb.patch"
sed -i "s|SOURCE_ROOT|$SOURCE_ROOT|g" Cargo.toml
sed -i "s|SOURCE_ROOT|$SOURCE_ROOT|g" core/iox_query_udf/build.rs
cargo build --profile release
sudo cp ./target/release/influxdb3 /usr/bin

3.4 Verify the version of InfluxDB

influxdb3 --version

Output should be similar to:

influxdb3 InfluxDB 3 Core, 3.10.0, revision a1e8994464c3fe0b44ee85e95c0714ad557ed7fc

3.5 Start the InfluxDB service (optional)

influxdb3 serve --object-store file --data-dir ~/.influxdb3 --node-id my-node-1

4. Test (optional)

cd $SOURCE_ROOT/influxdb
cargo nextest run --workspace --nocapture --no-fail-fast

References:

⚠️ **GitHub.com Fallback** ⚠️