How to build the Dart SDK for the Raspberry Pi

For a DIY project I’m working on I need to run a Dart project on my Raspberry Pi board, precisely in his Raspbian OS. The Dart team has done a good job publishing a wiki page with all the information to build the SDK. Here I’m summarizing the necessary steps in a handy list, or, if you prefer, at the end of the post you can find a zip file with the SDK already built.

MACHINE setup

I suggest you run the entire process in a virtual machine in order to have a clean environment and the best compatibility with the provided scripts.

  • Download the Ubuntu server 12.04.5 64-bit ISO.
  • Install your virtualization software, I’ve used VirtualBox.
  • Create a new Virtual Machine. In VirtualBox using the wizard, select Linux OS and Ubuntu 64 bit. Here’s my VM configuration:
    • 4 GB ram
    • 23 GB HD, the used space after the entire process is about 11 GB
    • 2 processors (the core available in my hosting machine)
    • TCP ssh port forwarding (My host OS is a Linux with sshd active)
  • Install Ubuntu server through the downloaded ISO. During the configuration, in the package selection phase, select the OpenSSH Server, we will use scp to copy the produced SDK.

READY TO START

Login in Ubuntu and create a working directory. All the following commands are relative to the created working folder.

DEPENDENCIES INSTALLATION

Download and run the script that installs all the necessary dependencies.

DEPOT TOOLS INSTALLATION

Download and setup the source code management tools provided for chromium.

SOURCE CODE DOWNLOAD

Download the Dart 1.7 source code (if you want the latest developed version use this url: http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps)

TOOL CHAIN DOWNLOAD

We are going to cross compile the code so we need the tool chain provided by Raspberry Pi.

SDK compilation

Finally we are ready to compile. In the meanwhile you can go to take a coffee.

SDK INSTALLATION

Copy the dart-sdk folder under the dart/out/ReleaseXARM folder to your Raspberry Pi machine (using scp or your folder explorer).

If you like to make the Dart commands available in the command line edit your .bashrc file in your Raspbian installation and add these lines (modify the dart-sdk path based on your installation path):

READY TO RUN

You can check if the dart installation is working by simply running it. You should see this output:

LET’S RUN HELLO WORLD

As final step let’s run a simple Hello World project. We can create such simple project quickly using the new Stagehand tool. First we need to install it:

We are now ready to create the project:

The project is ready, let’s get hits dependencies and run it:

THE FAST WAY

If all these steps scares you, then you can download the zipped folder with the Dart SDK that I’ve prepared. You’re downloading it and using it at your own risk.
dart-sdk-raspberry-pi-1.7.2

4 thoughts on “How to build the Dart SDK for the Raspberry Pi

  1. Pingback: Raspberry Pi talks to Arduino using Dart | Federico De Faveri's blog

  2. I missed the install of git and build-essential on the ubuntu VM, you might wanna add that somewhere, other than that, nice guide, worked like a charm 🙂 Big ty from some guy in the Netherlands :).

  3. is this guide alos for raspberry pi 2 or do i need to change something in the raspberry pi toolchain?

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.