環境
- Raspberry Pi 3 MODEL B
- Raspbian Stretch Lite
- Version:October 2018
- Release date:2018-10-09
- Kernel version:4.14
- Ruby 5.2.1
- Rails 2.5.1
sqlite3
と libsqlite3-dev
は入れてある
状況
ごくごく普通に rails new
してから rails c
や rails s
をすると以下のようなエラーが発生した。
$ bundle exec rails c
(かなり省略)
You may have encountered a bug in the Ruby interpreter or extension libraries.
(かなり省略)
結論
以下の点を修正したところ、期待通りの動作になった。
1. Gemfile で spring の部分をコメントアウト
(省略)
(省略)
2. config/boot.rb で bootsnap の部分をコメントアウト
(省略)
結果
$ bundle exec rails c
Loading development environment (Rails 5.2.1)
irb(main):001:0>
$ bundle exec rails s
=> Booting Puma
=> Rails 5.2.1 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
余談
Raspberry Pi 本体のストレージ*1で Rails を動かすのは無謀なので、外付けストレージを使うべきでしょう*2。さらに言えば ARM ではちょっとしたことでもハマったり x86_64 とは異なる処理をしなければならなかったりするので、ロックオンしてしまうのはちょい危険だと思いました。