SqLite3 LoadError: incompatible library version

2019-02-28 10:52发布

问题:

OS: Ubuntu 16, Rails 4, Ruby 2.1.2 error:

LoadError: incompatible library version - /home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.so
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require'
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `rescue in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:2:in `<top (required)>'
/home/user/work/cookbook/config/application.rb:7:in `<top (required)>'
/home/user/work/cookbook/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- sqlite3/2.3/sqlite3_native
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:4:in `require'
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:4:in `<top (required)>'
/home/user/work/cookbook/config/application.rb:7:in `<top (required)>'
/home/user/work/cookbook/Rakefile:4:in `<top (required)>'

Gemfile:

gem 'rails', '4.2.5.1'
gem 'sqlite3'

Gemfile.lock

sqlite3 (1.3.11)

when i change file sqlite3-1.3.11.gemspec at s.require_paths = ["lib"]
to s.require_paths= ["lib/sqlite3_native"] i have the same problem with another gems (about 10) like here
reinstall gem not working


what need to do to solve the problem?

回答1:

Need to use lower version of sqlite3 gem (1.3.10) instead v. 1.3.11 Before if needed uninstall all gems and write to Gemfile:

gem 'sqlite3', '~> 1.3', '>= 1.3.10'

and use $ bundle install

It's helps me