Raspberry Pi: install Dart VM, create and run helloword.dart

Environment
  • Ubuntu 16.04 LTS
  • arm-linux-gnueabihf (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  • Dart SDK, master 1.24.0-edge.eb1839b8fd453b6c0c93376346743fa96db48440
  • Raspberry Pi 3 Model B
Download and build Dart SDK

See Dart: build Dart SDK for x86 and ARM.

Important: though Raspberry Pi 3 has a 64-bit CPU the Raspbian OS does not support 64-bit builds at the moment of writing – we will build 32-bit Dart SDK for ARM.

Alternatively, you can download pre-built Dart SDK for ARM:

$ wget https://storage.googleapis.com/dart-archive/channels/stable/release/1.22.1/sdk/dartsdk-linux-arm-release.zip
Upgrade libstdc++ to 6.0.21

See Raspberry Pi: how to solve the “version `GLIBCXX_6.0.21′ not found” problem.

Copy Dart VM to Raspbbery Pi

Ubuntu:

$ cd dart-sdk/sdk
$ scp -r out/ReleaseXARM/dart-sdk/bin/dart pi@192.168.0.xxx:/home/pi

Raspberry Pi:

$ sudo mv dart /usr/local/bin

Restart Raspberry Pi ssh session, then check if Dart VM works:

$ dart --version
Dart VM version: 1.24.0-edge.eb1839b8fd453b6c0c93376346743fa96db48440 (Sun Apr 16 18:04:59 2017) on "linux_arm"
Hello World application

Create helloworld.dart file with the following content:

main() {
  print('Hello world!');
}

Run the application:

$ dart helloworld.dart 
Hello world!

 

 

 

Leave a Reply

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