Bedis9 website

Cross compile HAProxy 2.9 for aarch64 from x86_64 with QUIC

Posted on 2022-14-02

HAProxy is a reverse-proxy software Load-Balancer. It is very famous for its high performance and reliability. That's why we may want to run it anywhere we can.

I am the happy owner of a rock pi s device which embeds an aarch64 4 cores CPU. I could use HAProxy provided by armbian (version 2.6.12), but for my needs it's a bit old. I want to use latest revese connect feature from HAProxy in order to expose some internal services through an HAProxy running somewhere on Internet. And for this purpose I need HAProxy 2.9+. So I have to compile it.

I don't want to use this small CPU and poor microSD card to compile HAProxy, so I prefer using my old good laptop (a lenovo x230).

Because my laptop runs a x86_64 CPU, I have to cross compile to aarch64 and here is how I do it.


in my case, I wrote a Makefile to automate all these commands.

First, we need to install required packages:

sudo apt-get install --yes gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu

I usually have a $HOME/haproxy folder where I git clone various versions of HAProxy source code and dependency.

Now we have to prepare an OpenSSL library: - we'll use static compilation with HAProxy, so no need the share library - we'll install source files and openssl related objects into a dedicated directory: /opt/arm/openssl

cd haproxy
git clone
git checkout -b OpenSSL_1_1_1w OpenSSL_1_1_1w
make clean
./Configure linux-aarch64 CC=/usr/bin/aarch64-linux-gnu-gcc \
    --prefix=/opt/arm/openssl --openssldir=/opt/arm/openssl -static no-shared
make -j 4
sudo make install

Now, we're ready to compile HAProxy 2.9:

cd haproxy
git clone 2.9
make clean
make -f Makefile TARGET=linux-glibc CC=/usr/bin/aarch64-linux-gnu-gcc \
    USE_OPENSSL=y SSL_INC=/opt/arm/openssl/include SSL_LIB=/opt/arm/openssl/lib \
    CPU=armv8 \
    -j 4


one of the limitation here is that the binary produced will not be compatible with systemd, so just use an init file.