How to compile Unison for a Synology DS212+

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

  • unison -version
    unison version 2.40.63
    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

13 Comment

    Martin

    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

    16 Nov 2012 | Reply

  1. Anonymous

    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

    07 Feb 2013 | Reply

    • OLiver Rettig

      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

      18 Sep 2013 | Reply

  2. Markus

    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!

    15 Sep 2013 | Reply

  3. Martn Rüegg

    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.

    25 Sep 2013 | Reply

  4. davec

    # 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

    01 May 2014 | Reply

  5. michele

    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!

    17 Jul 2014 | Reply

  6. Piotr58

    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…

    23 Sep 2014 | Reply

  7. Michael Naylor

    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

    16 Feb 2015 | Reply

  8. john

    Thank you thank you thank you thank you!!!

    24 Apr 2016 | Reply

  1. NAS Synology : synchronisation bidirectionnelle avec Unison | Kaliseo
  2. Thias の blog » Blog Archive » Building Unison 2.32 for Synology DS211
  3. Building Unison 2.32 for Synology DS211 | Thias の blog

Leave a reply