compiling static binaries

Niv Waizer nwaizer at
Thu Jun 9 18:06:34 UTC 2022

For anybody trying to build a static binary:

Thanks to Han Boetes for the post here, advising to use musl.
Thanks to Florian Dejonckheere for posting this script:

Here is my small contrib on this, for the lazy folks.
I download the musl prebuild binaries for my arch from
My script is posted here:

or below:
# based on the solution by Florian Dejonckheere <
florian at>
# at

mkdir toolchain
echo "I: Downloading prebuilt toolchain"
wget --continue -O
/tmp/x86_64-linux-musl_pc.tar.xz|| echo "Failed to find
x86_64-linux-musl_pc-11.3.0.tar.xz. Please open your browser at and find the correct file to fix this"
tar -xf /tmp/x86_64-linux-musl_pc.tar.xz -C toolchain

echo "Native compiler is called gcc"
TOOLCHAIN_PATH="$(readlink -f $(dirname $(find . -name "gcc"))/..)"
echo "Use local gcc instead of the OS installed one"

echo "Get rsync source"
git clone

echo "Build rsync"
cd rsync/
make clean
export CC="gcc"
echo "Disable openssl xxhash zstd and lz4 as they did not configure even
after consulting the INSTALL"
./configure CFLAGS="-static" --host="x86" --disable-openssl
--disable-xxhash --disable-zstd --disable-lz4
strip rsync

Thanks for rsync,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rsync mailing list