LoginSignup
1
3

More than 5 years have passed since last update.

Raspberry Pi で Dartを動かす

Last updated at Posted at 2015-06-06

DartをRaspberry Pi用にビルドしていきます。

1 必要な物をもってくる

DartのビルドにはDartSDKのコードとRaspberry Piのクロスコンパイル用ツールが必要です。

mkdir dart4raspi
cd dart4raspi

#gclientのインストール
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"

#Dart SDKを持ってくる
gclient config https://github.com/dart-lang/sdk.git
gclient sync

#Raspberry Piのtoolsを持ってくる
git clone https://github.com/raspberrypi/tools.git

2 Dartをビルド

cd sdk
#build開始
./tools/build.py -m release -a arm \
 --toolchain=../tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian(-x64)/bin/arm-linux-gnueabihf \
  create_sdk

-x64 オプションは64bitのマシンでビルドする場合付けてください。

時間がかかりますので、気長に待ちましょう。ついでに自分の環境用のdart-sdkもビルドしてくれます。
ちなみに僕の場合、マシンのスペックの問題もあるのでしょうが二時間ほどかかりました。

3 sdkをRaspberry Piに送る

scp -r out/ReleaseXARM/dart-sdk pi@[raspberry pi ip address]:./dart-sdk

4 パスを通す

# on raspberry Pi
export PATH=`pwd`/dart-sdk/bin:"$PATH"

これでraspberry piでDartが使えるようになります。

ちなみに、Raspberry PiにあるGPIOを使うためには管理者権限で実行しなければいけないため、symlinksを貼っておいたほうが何かと便利だと思います。

sudo ln -s /path/to/your/dart-sdk/bin/* /usr/bin/

ちなみにエミュレーターを使うこともできます。その他の詳しい方法などが知りたい方は下のリンクを参照してください。

参考


Building Dart SDK for Raspberry Pi · dart-lang/sdk Wiki

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3