sqlite3-ruby: LoadError on Windows x64, Ruby 2.3
I tried to run the newly generated Rails app on a Windows x64 PC and it failed:
$ rails s
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from D:/Users/Serguei/Mes documents/projects/rails_draft/config/application.rb:16:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>
Environment:
- Windows 7 x64
- Ruby 2.3
- Rails 4.2.6
To reproduce:
- create a Rails app
rails new rails_app -T - run bundle
- run
rails s
Any tips on how to solve that ?
Thank you.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 9
- Comments: 15 (3 by maintainers)
Links to this issue
Commits related to this issue
- Update rake-compiler-dock to support RubyInstaller-2.3.0 This fixes issue #185. — committed to larskanis/sqlite3-ruby by larskanis 11 years ago
@ArieShout I had the same problem. Rebuilding from source as is did resolve the issue for me on Windows 7 64 bit without aforementioned commit. Here are the steps:
./configure --disable-sharedmake install DESTDIR=/c/dev/ruby/tmpgem uninstall sqlite3 --allgem install sqlite3 --platform=ruby -- --with-sqlite3-include=/c/dev/ruby/tmp/usr/local/include --with-sqlite3-lib=/c/dev/ruby/tmp/usr/local/libYou may change path where you stage sqlite3 binaries.
Note that folder structure of final gem is different. It has no subfolders for various ruby versions.
P.S. This SO question is relevant. The only difference is not to build shared version of sqlite3. Although there might be an option to use static version while building gem.
Hello all, The solution is: Edit file sqlite3-x.x.x.gemspec, change s.require_paths=[“lib”] to s.require_paths=[“lib/sqlite3_native”]
Linux/UNIX: /usr/local/share/gem/specifications/
Windows: C:\Ruby…\lib\ruby\gems\x.x.x\specifications
I fixed it with my similar problem.
Regards,
@mlt I resolved the problem similar to your steps. This does work when you require
sqlite3in Ruby. However, when used in Rails, the bundler will install the native version, which doesn’t work. I have to run bundle update, uninstall the native version withgem uninstall, and then edit thesqlite3entry in the Gemfile.lock tosqlite3 (1.3.11).