I wanted to build the unison file synchroniser for my Synology DS211 NAS. This is always complicated by the fact that unison is written in Ocaml. Here are the steps I followed, largely inspired by this post on compiling unison for a DS212+ and this post (in german) on installing unison 2.32 on a Bufallo NAS. All the instructions assume you run as root
. First you will need to install ipkg, beware that the built-in wget
does not work properly with ipkg
, so you need to manually install a newer version of wget
and then make sure that /opt/bin/
is early in your path so that ipkg can use it.
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/
wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/unison-2.32.52/unison-2.32.52.tar.gz
cd unison-2.32.52
vi update.mli
Remplace the line «
module NameMap : Map.S with type key = Name.t
» with «
module NameMap : MyMap.S with type key = Name.t
»make clean
make mkProjectInfo
make NATIVE=false UISTYLE=text CFLAGS=”-cclib -L/lib”
cp ./unison /opt/bin/
unison -version
The last command should return unison version 2.32.52
confirming that the binary works properly. To ensure that remote calls find the proper binary, add the following line to your unison configuration: servercmd = /opt/bin/unison
.
# 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