Building the dart sdk for armv6 via Docker

May 05, 2018

dart
docker
flutter
raspberry pi

Given the rising popularity of Flutter I wanted to play around with the underlying language and it’s sdk, Dart.

More specifically I wanted to use Dart on my Raspberry Pi Zero.

The official binaries of Dart VM / SDK support only ArmV7 which means Raspberry Pi 2 onward, as the Zero is ArmV6.

In the Dart Github there are some instructions on how to build the sdk, also for the Raspberry Pi 1, but those instructions seems to be outdated and they doesn’t cover my preferred Linux distribution, Archlinux.

So I decided to create a Dockerfile to use Docker to build the dart sdk for armv6, so that I can base my image on Debian and run it on any OS that supports Docker.

You can find the Dockerfile in my github repo: https://github.com/manhluong/dart_sdk_build_raspberry_pi_dockerfile

There you will also find the instructions on how to build and retrieve the binaries, in the README.

Anyway the instructions consist in building the docker image:

docker build .

Then retrieve the .zip with the binaries from the image:

docker images<br /> docker create IMAGE_ID<br /> docker cp CONTAINER_ID:/dart-sdk.zip .

At that point you can send the binaries to your Raspberry Pi Zero:

unzip dart-sdk.zip<br /> scp -r dart-sdk user@raspberry.zero.ip:/path/remote/folder

And once you set the PATH, you can try out Dart with the given test files:

dart_running_raspberry_pi_zero