How to compile Unison for a Synology DS212+

Note

(May 15, 2020): An updated guide for newer Synology devices can be found here:
How to compile unison for a Synology NAS (DSM 6.2)

Unison

This guide explains how to compile and install Unison on your Synology DS212+ NAS.

Compiling Unison

  • Install the dependencies
    sudo ipkg install ocaml make gcc textutils
    
  • Fix the pthreads library symlink (Borrowed from this site)
    sudo rm /opt/arm-none-linux-gnueabi/lib/libpthread.so.0
    sudo ln -s /lib/libpthread.so.0 /opt/arm-none-linux-gnueabi/lib/
    
  • Get the latest unison
    wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.40.63.tar.gz
    
  • Unpack unison
    tar zxvf unison-2.40.63.tar.gz
    
  • Change dir
    cd unison-2.40.63
    
  • Build (text version)
    make UISTYLE=text NATIVE=false
    
  • Install
    sudo cp unison /opt/bin
    

Testing Unison

  • Version
    unison -version
    unison version 2.40.63
    
  • Self test
    unison -selftest
    Contacting server...
    Running internal tests...
    backups 1 (local)...
    backups 2...
    backups 2a...
    backups 3...
    backups 4...
    backups 5 (directories)...
    backups 6 (backup prefix/suffix)...
    links 1 (directories and links)...
    links 2 (symlink to nowhere)...
    Success :-)
    
  • Clean up
    rm -Rf test-a.tmp
    rm -Rf test-b.tmp
    

14 responses

  1. Hello, sadly I get an error message during compiling unison: make tags tail: -1' option is obsolete; use -n 1’ Try tail --help' for more information. tail: -1’ option is obsolete; use -n 1' Try tail –help’ for more information. /bin/sh: bash: not found make[1]: Entering directory /volume1/@tmp/unison-2.40.63' if [ -f which etags` ]; then \ etags .mli */.mli .ml */.ml /.m .c */.c *.txt \ ; fi /bin/sh: etags: not found make[1]: [tags] Error 127 (ignored) Any idea why? Best regards Martin

    Martin – November 16th, 2012
  2. I came across this error as well when compiling for x86. Build still produced a usable executable. Others have had the same result: http://tech.groups.yahoo.com/group/unison-users/message/9607

    Anonymous – February 7th, 2013
  3. Just wanna say a big thank you! Your very simple but essential instructions helped my to set up sync between 2 Synology Diskstations. Have a good time, greetings from Vienna!

    Markus – September 15th, 2013
  4. I run into the same error: make tags make[1]: Entering directory /volume1/public/unison-2.40.102' if [ -f which etags ]; then \ etags *.mli */*.mli *.ml */*.ml */*.m *.c */*.c *.txt \ ; fi /bin/sh: etags: not found make[1]: [tags] Error 127 (ignored) make[1]: Leaving directory /volume1/public/unison-2.40.102’ compiling on a DS213

    OLiver Rettig – September 18th, 2013
  5. hello i had to install # ipkg install ncurses as well. i’ve compiled unison version 2.40.102 on a DS213+. this model is equipped with a PPC cpu, thus the above mentioned directory /opt/arm-none-linux-gnueabi is equivalent to the directory /opt/powerpc-linux-gnuspe as it is found on this system. so instead of # sudo rm /opt/arm-none-linux-gnueabi/lib/libpthread.so.0 # sudo ln -s /lib/libpthread.so.0 /opt/arm-none-linux-gnueabi/lib/ i run (as root): # rm /opt/powerpc-linux-gnuspe/lib/libpthread.so.0 # ln -s /lib/libpthread.so.0 /opt/powerpc-linux-gnuspe/lib/ but i found additional libraries that had invalid refernces. so i did the same for libm and libdl: # rm /opt/powerpc-linux-gnuspe/lib/libm.so.6 # ln -s /lib/libm.so.6 /opt/powerpc-linux-gnuspe/lib/ # rm /opt/powerpc-linux-gnuspe/lib/libdl.so.2 # ln -s /lib/libdl.so.2 /opt/powerpc-linux-gnuspe/lib/ additionally i had to do a similar workaround for libncurses: # rm /opt/lib/libncurses.so.5 # ln -s /lib/libncurses.so.5 /opt/lib the error with the ‘etags” appeared as well. i just ignored it. the unison-binary created worked well. regards, martin.

    Martn Rüegg – September 25th, 2013
  6. I can confirm that the following worked for me on a DS212+ running DSM 5.0-4482 # Note the extra libdl.so step to avoid ‘undefined reference to `_dl_tls_get_addr_soft@GLIBC_PRIVATE” compile errors

    ipkg install ocaml make gcc textutils rm /opt/arm-none-linux-gnueabi/lib/libpthread.so.0 ln -s /lib/libpthread.so.0 /opt/arm-none-linux-gnueabi/lib/ rm /opt/arm-none-linux-gnueabi/lib/libdl.so ln -s /lib/libdl.so.2 /opt/arm-none-linux-gnueabi/lib/libdl.so cd /volume1/@tmp wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/unison-2.40.65/unison-2.40.65.tar.gz tar xf unison-2.40.65.tar.gz cd unison-2.40.65/ make clean make mkProjectInfo make NATIVE=false UISTYLE=text CFLAGS=”-cclib -L/lib” cp ./unison /opt/bin/ cd /volume1/@tmp rm -rf unison-2* unison -version

    davec – May 1st, 2014
  7. Thank you! I ALMOST got it to work on a DS1513+ with the latest DSM 5. I compiled, but it was segfaulting. Out of desperation I tried to compile on my laptop (Ubuntu 14.04) copied the executable, and copied libtinfo.so.5 from my /usr/lib64 to /lib64 on the NAS. It just works!

    michele – July 17th, 2014
  8. On DSM 5 I have some trouble. 1) ln on libpthread The directory “/opt/arm-none-linux-gnueabi” depend on processor with intel it must be “” 2) Makefile.Ocaml prepend we have “emacs” Makefile.Ocaml use “etags” and “etags” is a part of emacs so we must install it with: sudo ipkg install emacs22 3) Makefile.Ocaml use “tail -1” and this use is obsolete. So We must modify the file from “tail -1” to “tail -n 1” (3 occurs) 4) Makefile.Ocaml refer “bash” On line 324, we have: # ifeq ($(shell echo type -t ocamldot | bash), file) but my Synology rs3412 and DSM 5 only have “ash”! So, we must also install it or modify the Makfile… Finaly, the compilation seem to be ok but, like “michele”, I have a “Segmentation fault”. So, Ihave done like Michele from the unison on our Debian server…

    Piotr58 – September 23rd, 2014
  9. Found 1 additional sym link needed to get complie working on DS211j using DSM 5.1-5022 Update 2 ln -s /lib/libdl.so.2 /opt/arm-none-linux-gnueabi/lib/libdl.so

    Michael Naylor – February 16th, 2015
  10. Thank you thank you thank you thank you!!!

    john – April 24th, 2016
  11. This is an interpreter failure… change it to the newer format https://github.com/bcpierce00/unison/commit/c64b007ca0c20e1cea94a79b82d7c415aa3729eb

    nickma – November 16th, 2018
  12. Change the line according to: https://github.com/bcpierce00/unison/commit/c64b007ca0c20e1cea94a79b82d7c415aa3729eb

    nickma – November 16th, 2018
  13. As this is one of the first results when googling for unison on synology, here’s some updated news: https://github.com/bcpierce00/unison/issues/290

    Mark – October 13th, 2019
  14. Thanks! I’ve updated the guide and also linked to that github issue.

    Laurence Muller May 15th, 2020