Installing sqlite3 for Rails on Windows XP

Here is a short description how to install sqlite3 with RubyGems on Windows XP.

First download sqlite-3_x_x.zip and sqlitedll-3_x_x.zip from http://www.sqlite.org/download.html. Either extract the files into

1
<drive>:\your\path\to\ruby\bin

or set your PATH environment variable to

1
set PATH=C:\path\to\sqlite;%PATH%

Now, if you try to install sqlite3-ruby on Windows XP with

1
C:\>gem install sqlite3-ruby

and get this error message:

1
2
3
4
5
6
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
c:/Programme/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

Then that’s because gem tries to install a sqlite3 version higher than 1.2.2 that requires some header files for compiling which are not present on your system.

Instead install sqlite3 version 1.2.2

1
C:\>gem install sqlite3-ruby -v=1.2.2

Now you should see this:

1
2
3
4
5
C:\>gem install sqlite3-ruby -v=1.2.2
Successfully installed sqlite3-ruby-1.2.2-x86-mswin32
1 gem installed
Installing ri documentation for sqlite3-ruby-1.2.2-x86-mswin32...
Installing RDoc documentation for sqlite3-ruby-1.2.2-x86-mswin32...

That’s it

  • Drif

    Thanks for show those errors i was going crazy with the fail to build =)