Building HAProxy - linux-on-ibm-z/docs GitHub Wiki
Building HAProxy
Below versions of HAProxy are available in respective distributions at the time of creation of these build instructions:
- RHEL 8.10 has
1.8.27 - RHEL (9.6, 9.7, 9.8) have
2.8.14 - RHEL (10.0, 10.1, 10.2) have
3.0.5 - SLES 15 SP7 has
2.8.11 - Ubuntu 22.04 has
2.4.30 - Ubuntu 24.04 has
2.8.16
The instructions provided below specify the steps to build HAProxy version 3.4.0 on Linux on IBM Z for 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 and Install HAProxy
1.1. Build using script
If you want to build haproxy using manual steps, go to STEP 1.2
Use the following commands to build HAProxy using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/HAProxy/3.4.0/build_haproxy.sh
# Build HAProxy
bash build_haproxy.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.
1.2. Install the build dependencies
export SOURCE_ROOT=/<source_root>/
export PATCH_URL=https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/HAProxy/3.4.0/patch
-
RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
sudo yum install -y gcc gcc-c++ git gzip make tar wget xz zlib-devel lua-devel patch pcre2 pcre2-devel systemd-devel openssl-devel diffutils perl -
SLES 15 SP7
sudo zypper install -y awk gcc gcc-c++ gzip make tar wget xz zlib-devel libopenssl-devel lua54-devel patch pcre2-devel systemd-devel -
SLES 16
sudo zypper install -y awk diffutils gcc gcc-c++ gzip make tar wget xz zlib-devel libopenssl-devel lua54-devel patch pcre2-devel systemd-devel -
Ubuntu (22.04, 24.04)
sudo apt-get update sudo apt-get install -y gcc g++ gzip make tar wget curl xz-utils zlib1g-dev liblua5.4-dev patch libpcre2-dev libsystemd-dev libssl-dev
1.3. Install additional dependencies
- Lua 5.4.0 (RHEL 8.x)
cd $SOURCE_ROOT wget https://www.lua.org/ftp/lua-5.4.0.tar.gz tar zxf lua-5.4.0.tar.gz cd lua-5.4.0 sed -i '61 i \\t$(CC) -shared -ldl -Wl,-soname,liblua$R.so -o liblua$R.so $? -lm $(MYLDFLAGS)\n' src/Makefile make clean make linux "MYCFLAGS=-fPIC" "R=5.4" sudo make install sudo cp /usr/local/bin/lua* /usr/bin/ sudo cp src/liblua5.4.so /usr/lib64/ sudo rm -f /usr/lib64/liblua.so sudo ln -s /usr/lib64/liblua5.4.so /usr/lib64/liblua.so lua -v
Note: All supported RHEL distributions use the distro-provided OpenSSL installed through the openssl-devel package.
1.4. Download HAProxy source package
cd $SOURCE_ROOT
wget https://www.haproxy.org/download/3.4/src/haproxy-3.4.0.tar.gz
tar xzvf haproxy-3.4.0.tar.gz
cd haproxy-3.4.0
1.5. Build and Install HAProxy
make all TARGET=linux-glibc USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1
sudo make install
sudo ln -sf /usr/local/sbin/haproxy /usr/sbin/
Note: For more advanced build options, please visit the installation documention for HAProxy.
haproxy -v
You will get output similar to this:
HAProxy version 3.4.0-0a72d7f9f 2026/05/11 - https://haproxy.org/
Status: stable branch - will stop receiving fixes around Q1 2027.
Known bugs: http://www.haproxy.org/bugs/bugs-3.4.0.html
Running on: Linux 6.8.0-124-generic #124-Ubuntu SMP Tue May 26 12:01:41 UTC 2026 s390x
2. Testing - Regression Tests (optional)
2.1. Install distro packages needed for running the tests.
-
RHEL 8.10
sudo yum install -y socat curl python2 python38 -
RHEL (9.6, 9.7, 10.0, 10.1)
sudo yum install -y socat curl python3 -
RHEL (9.8, 10.2)
sudo yum install -y socat curl python3 crypto-policies-scripts -
SLES (15 SP7, 16)
sudo zypper install -y ninja socat python3 curl -
Ubuntu 22.04
sudo apt-get update sudo apt-get install -y ninja-build socat curl python2 python3 -
Ubuntu 24.04
sudo apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata ninja-build socat curl python3
2.2. Run regression tests.
cd $SOURCE_ROOT
cd haproxy-3.4.0
# Add patch for correcting pointer types of different size on s390x
curl -fsSL ${PATCH_URL}/aes_gcm.patch -o aes_gcm.patch
patch -p0 < aes_gcm.patch
# Add JWE/JWT patch for correcting OpenSSL length handling on s390x
curl -fsSL ${PATCH_URL}/jwe_s390x.patch -o jwe_s390x.patch
patch -p0 < jwe_s390x.patch
scripts/build-vtest.sh
make -C addons/wurfl/dummy
make -j$(nproc) all \
ERR=1 \
TARGET=linux-glibc \
CC=gcc \
DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \
USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_PROMEX=1 USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern \
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
sudo make install
- For RHEL (9.8, 10.2)
ORIGINAL_CRYPTO_POLICY="$(update-crypto-policies --show)"
sudo update-crypto-policies --set LEGACY
ulimit -n 65536
export VTEST_TIMEOUT="${VTEST_TIMEOUT:-60}"
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
TEST_RC=$?
sudo update-crypto-policies --set "$ORIGINAL_CRYPTO_POLICY"
test "$TEST_RC" -eq 0
- For other supported distributions
ulimit -n 65536
export VTEST_TIMEOUT="${VTEST_TIMEOUT:-60}"
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel