LoginSignup
6
6

More than 5 years have passed since last update.

ラズパイ2にRaspbian GNU/Linuxを入れてErlang R18をソースからインストールしてみた

Last updated at Posted at 2015-09-09

opensslのライブラリの参照の設定以外は特にハマりどころは無いと思います。

構成

HW

  • Raspberry Pi 2 B
  • microSD card 8GB Class 10(Transcend)
  • USB/Serial (FTDI)ケーブル
  • micro USB給電ケーブル

Sowftware

  • Raspbian GNU/Linux
    • Release date: 2015-05-05
    • Kernel version: 3.18
    • SHA-1: cb799af077930ff7cbcfaa251b4c6e25b11483de
  • Erlang R18 sourcode fron Erlang central
    • (Erlang Solutionsのprecompiled erlはraspberry pi向けはR15だったので)

OS インストール

OS imageをSDカードに焼き込み

imageファイル

bash-3.2$ ls -l *.img
-rw-r--r--@ 1 ogakiaid  staff  3276800000  5  7 01:00 2015-05-05-raspbian-wheezy.img

SDカードを挿入してデバイス名を確認

bash-3.2$ df
Filesystem    512-blocks      Used Available Capacity  iused   ifree %iused  Mounted on
/dev/disk1     370368512 364384376   5472136    99% 45612045  684017   99%   /
devfs                671       671         0   100%     1161       0  100%   /dev
/dev/disk0s4   117197656  62421176  54776480    54%  7802645 6847060   53%   /Volumes/BOOTCAMP
map -hosts             0         0         0   100%        0       0  100%   /net
map auto_home          0         0         0   100%        0       0  100%   /home
/dev/disk3s1    15742976      4800  15738176     1%        0       0  100%   /Volumes/NO NAME

/dev/disk3s1がSDカードのようなので、アンマウント。

bash-3.2$ sudo diskutil umount /dev/disk3s1
Volume NO NAME on disk3s1 unmounted

この状態でイメージファイルを書き込む。
/dev/disk3s1ではなくて、/dev/disk3 に書き込むところが重要。

bash-3.2$ sudo dd if=2015-05-05-raspbian-wheezy.img of=/dev/disk3 bs=1m
3125+0 records in
3125+0 records out
3276800000 bytes transferred in 4131.853238 secs (793058 bytes/sec)

SDカードをMacからはずしてraspberry piに挿入。
有線Ethernetケーブルを接続

起動してssh接続

USBケーブル経由でRaspberry Pi2の電源を投入

緑のLEDの点滅がおさまれば起動完了。

デフォルトの状態ではDHCPするので、DHCPサーバーのリースを監視するかヤマカンでIPアドレスを当てる。他にDHCPでアドレスを取得しているPCがあれば大抵はその次のアドレス。
<2015.10.20追記:2015-09-24-raspbian-jessieのバージョンでは最初からOSXからraspberrypi.localのホスト名でアクセスできました>

sshで接続

ssh pi@IPアドレス

パスワードの初期値はraspberry

バージョンを確認してみる。

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

ラズパイの初期設定

 $ sudo raspi-config

wifiの設定などをしないのであれば、以下のポイントだけでしょうか。

  • SDの容量を最大限利用する:

設定結果の確認

$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
rootfs           7629512 2510968   4758340  35% /
/dev/root        7629512 2510968   4758340  35% /
devtmpfs          470416       0    470416   0% /dev
tmpfs              94944     224     94720   1% /run
tmpfs               5120       0      5120   0% /run/lock
tmpfs             189880       0    189880   0% /run/shm
/dev/mmcblk0p1     57288   19400     37888  34% /boot
 $ pwd
/home/pi

Erlangの導入

最新のsource codeを http://www.erlang.org/download.html からダウンロードしておいたものをscpで転送。2015/8/7時点でのバージョンは18.0
<2015/9/10追記:最初からwgetが使えるようですので、そちらのほうが簡単ですね。>

scp otp_src_18.0.tar.gz pi@<IPアドレス>:/home/pi/

改めてraspberry piにssh接続して作業。

$ tar zxf otp_src_18.0.tar.gz
$ cd otp_src_18.0

./HOWTO/INSTALL.mdを読んで、それに従って以下実行。

$ export ERL_TOP=`pwd`
$ ./configure --with-ssl=/usr/lib/ssl

追加インストールするライブラリはncursesとlibsslのヘッダなど

$ sudo apt-get update
$ sudo apt-get install libncurses5-dev libssl-dev

configureを実施してビルドの準備

$ sudo ln -s /usr/lib/ssl /usr/lib/openssl
$ ./configure --lib-ssl=/usr/lib

*********************************************************************
**********************  APPLICATIONS DISABLED  **********************
*********************************************************************

odbc           : ODBC library - link check failed

*********************************************************************
*********************************************************************
**********************  APPLICATIONS INFORMATION  *******************
*********************************************************************

wx             : wxWidgets not found, wx will NOT be usable
erts           : 

                 WARNING:
                   Only gcc's __sync_* builtins available for
                   atomic memory access. This will cause lots
                   of expensive and unnecessary memory barrier
                   instructions to be issued which will make
                   the performance of the runtime system
                   suffer. You are *strongly* advised to
                   upgrade to a gcc version that supports the
                   __atomic_* builtins (at least gcc version
                   4.7) or build with libatomic_ops. See the
                   "Atomic Memory Operations and the VM"
           chapter of $ERL_TOP/HOWTO/INSTALL.md for
                   more information.


*********************************************************************
*********************************************************************
**********************  DOCUMENTATION INFORMATION  ******************
*********************************************************************

documentation  : 
                 xsltproc is missing.
                 fop is missing.
                 xmllint is missing.
                 The documentation can not be built.

*********************************************************************

ビルド実施

$ export LANG=C
$ make && sudo make install

Erlangの起動

$ erl
Erlang/OTP 18 [erts-7.0] [source] [smp:4:4] [async-threads:10] [kernel-poll:false]

Eshell V7.0  (abort with ^G)
1>
6
6
6

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
6
6