-
Notifications
You must be signed in to change notification settings - Fork 56
Building librdkafka
Below versions of librdkafka are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.8, 8.10) have
1.6.1-1.el8
- RHEL (9.2, 9.4, 9.5) have
1.6.1-102.el9
- SLES 15 SP6 has
0.11.6-1.6.1
The instructions provided below specify the steps to build librdkafka version 2.8.0 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4, 9.5)
- SLES 15 SP6
- Ubuntu (20.04, 22.04, 24.04, 24.10)
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.
If you want to build librdkafka using manual steps, go to STEP 1.2.
Use the following commands to build librdkafka using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/librdkafka/2.8.0/build_librdkafka.sh
# Build librdkafka
bash build_librdkafka.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 2. In case of error, check logs
for more details or go to STEP 1.2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.8, 8.10, 9.2, 9.4, 9.5)
sudo yum install -y git openssl-devel cyrus-sasl-devel python3 gcc gcc-c++ zlib-devel binutils make sudo yum install -y wget tar perl #for rhel8.x
-
SLES 15 SP6
sudo zypper install -y binutils gcc make libz1 zlib-devel git gcc-c++ openssl-devel sudo zypper install -y wget tar
-
Ubuntu (20.04, 22.04, 24.04, 24.10)
sudo apt-get update sudo apt-get install -y git build-essential make zlib1g-dev libpthread-stubs0-dev libssl-dev libsasl2-dev libzstd-dev libcurl4-openssl-dev sudo apt-get install -y wget tar #for ubuntu20.04
-
Install OpenSSL 3.4.0
# only for rhel8.8, rhel8.10, ubuntu20.04
NAME_OSSL=openssl
VERSION_OSSL=3.4.0
cd $SOURCE_ROOT
wget https://github.com/openssl/openssl/releases/download/openssl-$VERSION_OSSL/openssl-$VERSION_OSSL.tar.gz
tar -xzf openssl-$VERSION_OSSL.tar.gz
cd openssl-$VERSION_OSSL
./config --libdir=/usr/local/lib
make -j$(nproc)
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
openssl version
# only for rhel8.8, rhel8.10, ubuntu20.04
export CFLAGS="-I/usr/local/include"
export LIBS="-L/usr/local/lib"
-
Download source
cd $SOURCE_ROOT git clone -b v2.8.0 https://github.com/confluentinc/librdkafka.git cd librdkafka/
-
Configure
./configure --install-deps
-
Build and install
make sudo make install
cd $SOURCE_ROOT/librdkafka
make -C tests -j1 run_local_quick
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
#include<stdio.h>
#include<librdkafka/rdkafka.h>
int main(){
printf("librdkafka version: %s\n", rd_kafka_version_str());
return 0;
}
gcc -o verify_librdkafka verify_librdkafka.c -lrdkafka
./verify_librdkafka
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.