Compiling Erlang for Synology DS211, DSM 5.1

5 Jul 2015 19:16 erlang synology-nas

I wanted to get Erlang running on my Synology NAS, for various reasons, and was struggling with the cross compiler.

Fortunately, I found the SynoCommunity website, and more specifically, the github repository for the same.

The instructions there state:

it is recommended to use a virtual machine with an x86, 32-bit version of Debian stable

So, using vagrant, I fired up a 32-bit Debian “Wheezy” VM. Why wheezy? Because I had problems building the native Erlang on anything newer.

host$ mkdir syno
host$ cd syno

host$ vagrant init puppetlabs/debian-7.8-32-nocm
host$ vagrant up
host$ vagrant ssh

Inside the VM:

vagrant$ sudo apt-get -y update
vagrant$ sudo apt-get -y upgrade
vagrant$ sudo apt-get -y install build-essential git ncurses-dev libssl-dev

vagrant$ git clone https://github.com/SynoCommunity/spksrc.git
vagrant$ cd spksrc/
vagrant$ make setup

vagrant$ pushd native/erlang/
vagrant$ make
vagrant$ popd

vagrant$ pushd cross/erlang/
vagrant$ make arch-88f6281

vagrant$ cd work-88f6281-5.1/install
vagrant$ tar cfz /vagrant/erlang-R16B03-1-88f6281-5.1.tar.gz .

OK, we now have an Erlang tarball. Copy it onto the DiskStation:

host$ scp erlang-R16B03-1-88f6281-5.1.tar.gz root@diskstation:/

and unpack it:

DiskStation> cd /
DiskStation> tar xfz erlang-R16B03-1-88f6281-5.1.tar.gz
DiskStation> erl
Erlang R16B03-1 (erts-5.10.4) [source] [async-threads:10] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1>

Done. One copy of Erlang R16B03-1 running on my Synology NAS box.