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:
https://github.com/JBBgameich/rsync-static

Here is my small contrib on this, for the lazy folks.
I download the musl prebuild binaries for my arch from
skarnet.org/toolchains
My script is posted here:
https://github.com/nwaizer/rsync-static/blob/main/build_static.sh

or below:
#!/bin/bash
# based on the solution by Florian Dejonckheere <
flor...@floriandejonckheere.be>
# at https://github.com/JBBgameich/rsync-static

mkdir toolchain
echo "I: Downloading prebuilt toolchain"
wget --continue
https://skarnet.org/toolchains/native/x86_64-linux-musl_pc-11.3.0.tar.xz -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
https://skarnet.org/toolchains/native 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"
export PATH=$TOOLCHAIN_PATH/bin:$PATH

echo "Get rsync source"
git clone https://github.com/WayneD/rsync.git

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
make
strip rsync

Thanks for rsync,
Niv
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to