ARM-ed with Reason

I’ve been enjoying working with Reason, and looking at ways to combine ARM, Reason and Docker. Check out this tutorial on how to build Reason apps for an ARM target using the Docker for Mac beta program. Reason is packaged as a Docker image, so local installation is unnecessary, and Docker’s multiarch support means no need for cross-compilation - what a breeze!

I am using Docker for Mac, which is still under beta program. Using Docker for development has two important advantages over traditional cross-compilation. First, the Reason toolchain comes packaged as a Docker image and hence no local installation is necessary. Secondly, cross-compiler are often tricky to get right. Docker for Mac comes with multiarch support and hence removes the need for traditional cross-compilation.


I will be testing using a Cubietruck running Linaro Desktop. But these instructions should also work for Raspbian, a Debian optimized for the Raspberry pi hardware.


First get the dockerfile for Reason toolchain and build the image.

$ mkdir /tmp/reason_arm
$ cd /tmp/reason_arm
$ wget
$ docker build -t reason-arm .

All set! Let’s build a “Hello, World!” program.

$ mkdir /tmp/reason_arm_hello
$ cd /tmp/reason_arm_hello
$ echo 'print_endline "Hello, Reason!"' >
$ docker run -it -v `pwd`:/src reason-arm
$ cd /src
$ rebuild hello.native

The build artifacts are found in the host machines /tmp/reason_arm_hello/_build directory.

$ file _build/hello.native
_build/hello.native: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped

We can now transfer the file to the cubietruck and run it. My cubietruck’s IP address is

$ scp _build/hello.native linaro@
$ ssh linaro@
Welcome to Linaro 13.04 (GNU/Linux 3.4.61+ armv7l)
* Documentation:
Last login: Fri May 20 08:35:01 2016 from
linaro@cubietruck:~$ ./hello.native
Hello, reason!

Related Posts