How to build a static Unison binary

The current documentation for Unison (as at 2.32.52) is slightly out of date, because the STATIC=true option to the Makefile does not do anything. The fix is to grab the patch file from this post and then apply it as follows:

cd unison-2.32.52
patch -p0 < ../patch-unison-static
make STATIC=true

Very handy if you have to run unison on a system with an old glibc.

3 thoughts on “How to build a static Unison binary

  1. Hi Carlo. The link to the patch seems to be dead. You wouldn’t happen to have a copy of it lying around that you could share, would you?

  2. I looked in my archives but couldn’t find this patch. It’s a real shame that gmane shut down. Also couldn’t find it on the Wayback Machine.

    I couldn’t build 2.32.52 on my Mint 19 laptop at all.

    But the latest version on GitHub does build and using STATIC=true on the make command produced a static binary for me:

    $ file src/unison
    src/unison: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=1c8c9bb8b1076df35b6389b207fd11d97bb0a5c2, not stripped

    Grab the source from here: https://github.com/bcpierce00/unison

Leave a Reply