LoginSignup
1
1

More than 5 years have passed since last update.

Raspberry PiにF#の実行環境をインストールする

Posted at

今回試してみた環境は次の通り。

[ハードウェア]
・Raspberry Pi Model A+

[ソフトウェア]
・Raspbian Wheezy (Release date:2015-05-05)
・Mono 3.2.8
・F# 4.0.0.3

概要

Monoはapt-getで、F#は自分でビルドしてインストールする。
ただし、F#はRaspberry Pi上でビルドしようとしてもエラーが発生するので、PC上でビルドしてからRaspberry Piにコピーしてインストールする。

Monoのインストール

Raspberry Piでapt-getを使ってMonoをインストールする。

# @Raspberry Pi
$ sudo apt-get install mono-complete

F#のインストール

F#はapt-getからインストールできないのでビルドする必要があるけど、概要で言ったようにRaspberry Pi上ではビルドできないので、PCの仮想マシン(Ubuntu)上でビルドして、生成されたファイルを使ってRaspberry Pi上でインストールする。

このときUbuntuとRaspberry Piで作業ディレクトリのパスを一致させる必要があるので、"/tmp/build/"を作業ディレクトリとする。

UbuntuでF#をビルド

まずはビルドにautomakeが必要なのでインストールする。

# @Ubuntu
$ sudo apt-get install automake

あとはF#のリポジトリに書いてある手順でビルドする。ただし、"sudo make install"はせずにその直前のmakeまでやる。

fsharp/fsharp

# @Ubuntu
$ mkdir /tmp/build/
$ cd /tmp/build/
$ git clone https://github.com/fsharp/fsharp
$ cd fsharp
$ git checkout 4.0.0.3
$ ./autogen.sh --prefix=/usr
$ make -j4

Raspberry Piに転送

Ubuntuの"/tmp/build/fsharp"をまるごとRaspberry Piに転送する。

# @Ubuntu
$ cd /tmp/build/
$ scp -r /tmp/build/fsharp/ pi@[Raspberry PiのIPアドレス]:/tmp/bulid/

Raspberry Piでインストール実行

Raspberry Piでインストールを実行する。

# @Raspberry Pi
$ cd /tmp/build/fsharp/
$ sudo make install

確認

monoとfsharpcのバージョンを表示してインストールできたか確認する。

# @Raspberry Pi
$ mono -V
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
...
$ fsharpc --help
F# Compiler for F# 4.0 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
...
1
1
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
1