compiling static binaries

Han Boetes han at boetes.org
Tue Apr 3 10:52:09 UTC 2018


For anybody trying to build a static binary:


Glibc static binaries are not backwards compatible: to get really
static binaries you'd have to compile them with musl libc.

The easiest way for me was to set up a VM with alpine linux. Then I
configured and build rsync and at the end ran these commands to get a
static binary:

cp /usr/lib/libacl.a .
gcc -static -O2 -Wall -static-libgcc -W -o rsync $(find . -name '*.o') libacl.a
strip rsync

And the resulting binary works fine on an ancient (2008) machine.



# Han



More information about the rsync mailing list