Tuesday, December 14, 2010

sqlite3-ruby 1.3.2 on Windows 'Error'

When I created a new rails app ran bundle install I noticed a new version of sqlite3-ruby was installed.

...
Installing sqlite3-ruby (1.3.2)
...

When I tried to start the server I got this message.

C:\web\testapp>rails s
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.2-x86-mingw32/lib/sqlite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (Load Error)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.2-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.2-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
from C:/web/testapp/config/application.rb:7:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `block in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

I thought I'd reinstall it, since that's what one does on windows, and I got some more information.

C:\web\testapp>gem install sqlite3-ruby

=============================================================================

You've installed the binary version of sqlite3-ruby.
It was built using SQLite3 version 3.7.3.
It's recommended to use the exact same version to avoid potential issues.

At the time of building this gem, the necessary DLL files where available
in the following download:

http://www.sqlite.org/sqlitedll-3_7_3.zip

You can put the sqlite3.dll available in this package in your Ruby bin
directory, for example C:\Ruby\bin

=============================================================================

Successfully installed sqlite3-ruby-1.3.2-x86-mingw32
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.2-x86-mingw32...
Installing RDoc documentation for sqlite3-ruby-1.3.2-x86-mingw32...


Let's look at what was installed.

C:\web\testapp>gem list --local -d sql

*** LOCAL GEMS ***

sqlite3-ruby (1.3.2)
Platform: x86-mingw32
Authors: Jamis Buck, Luis Lavena, Aaron Patterson
Rubyforge: http://rubyforge.org/projects/sqlite3-ruby
Homepage: http://github.com/luislavena/sqlite3-ruby
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

This module allows Ruby programs to interface with the SQLite3
database engine (http://www.sqlite.org)

I downloaded the file at http://www.sqlite.org/sqlitedll-3_7_3.zip and copied the DLL into my C:\Ruby192\bin folder since that's where I have it installed.

Let's give it a try

C:\web\testapp>rails s
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-12-14 11:37:09] INFO WEBrick 1.3.1
[2010-12-14 11:37:09] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32]
[2010-12-14 11:37:09] INFO WEBrick::HTTPServer#start: pid=2080 port=3000
[2010-12-14 11:37:56] INFO going to shutdown ...
[2010-12-14 11:37:57] INFO WEBrick::HTTPServer#start done.

It works.

2 comments:

Albert said...

Thanks! Was facing the same problem...

dale said...

Thank you for posting this. You got me running.

You'd think the rails team would be more interested in releasing a package for windows that actually did work out of the box, like they claim.