LoginSignup
10

More than 3 years have passed since last update.

[CentOS][Gem]Error: Your version of SQLite (3.7.17) is too old. Active Record supports SQLite >= 3.8. 解決法

Posted at

起こったこと

Rails 6 project で gem 'sqlite3' を使用して bundle install すると
SQLite が古い とエラー

'./rails-proj/'
$ bundle install
...
Your version of SQLite (3.7.17) is too old. Active Record supports SQLite >= 3.8.
...
Failed

OSの sqlite3 が古いのかと思い、
こちらを参考に 自分で最新sqlite3 (3.8.11) をインストール し
https://qiita.com/8zca/items/175efb0612070530d186

option 指定で gem install

エラーは変わらない。

# 自分でインストール
$ /opt/sqlite/sqlite3/bin/sqlite3 --version
3.32.3 
$ bundle config build.sqlite3 --with-sqlite3-include=/opt/sqlite/sqlite3/include \
   --with-sqlite3-lib=/opt/sqlite/sqlite3/lib
$ bundle exec gem install sqlite3
...
Failed

原因

どうやら sqlite3 をコンパイルする際にOSの sqlite.x86_64 nativeライブラリが必要のようで
そのversion が古いよう

$ yum list | grep sqlite
...
sqlite.x86_64                            3.7.17-1.fc21                @/sqlite-3.7.17-1.fc21.x86_64
...

Yum の標準repo で登録されてるsqlite version は古いので yum install sqlite-* で入らない。

$ yum --showduplicates list sqlite
..
Available Packages
sqlite.i686                                                 3.7.17-8.el7_7.1                                                base
sqlite.x86_64                                               3.7.17-8.el7_7.1                                                base

解決策

自分でrpmからインストールする
(最新version は glibc が必要で CentOS7は未対応そうなので
とりあえず sqlite v3.8.11)

$ wget https://kojipkgs.fedoraproject.org//packages/sqlite/3.8.11/1.fc21/x86_64/sqlite-devel-3.8.11-1.fc21.x86_64.rpm

$ wget https://kojipkgs.fedoraproject.org//packages/sqlite/3.8.11/1.fc21/x86_64/sqlite-3.8.11-1.fc21.x86_64.rpm

$ sudo yum install sqlite-3.8.11-1.fc21.x86_64.rpm sqlite-devel-3.8.11-1.fc21.x86_64.rpm

$ yum list | grep sqlite
Installed Packages
sqlite.x86_64                                               3.8.11-1.fc21                                                   @/sqlite-3.8.11-1.fc21.x86_64

そして bundle install も通った

'./rails-proj/'
$ bundle install
...
Installed!

参考

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
10