How do I install Ruby's SQLite3 extension on Windows?-Collection of common programming errors

This is the first time I am running Ruby on Rails.

When running the “blog” application I got the message “We’re sorry, but something went wrong. We’ve been notified about this issue and we’ll take a look at it shortly.”

Then I checked the CODE\blog\log\development.log and got this:

/!\ FAILSAFE /!\  Tue Jun 30 15:22:55 +0100 2009
 Status: 500 Internal Server Error
 no such file to load -- sqlite3
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:156:in `require'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:521:in `new_constants_in'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:156:in `require'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/kernel/requires.rb:7:in
`require_library_or_gem'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
   c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/kernel/requires.rb:5:in
`require_library_or_gem'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/sqlite3_adapter.rb:10:in
`sqlite3_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
   c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
123:in `retrieve_connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
115:in `connection'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/query_cache.rb:9:in `cache'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/query_cache.rb:28:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/head.rb:9:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/methodoverride.rb:24:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/params_parser.rb:15:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/rewindable_input.rb:25:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/session/cookie_store.rb:93:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/reloader.rb:9:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/failsafe.rb:11:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/lock.rb:11:in `synchronize'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/dispatcher.rb:106:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/
static.rb:31:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/urlmap.rb:46:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in `each'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/
log_tailer.rb:17:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/content_length.rb:13:in `call'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/handler/webrick.rb:46:in
`service'
   c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
   c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
   c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
   c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/handler/webrick.rb:13:in `run'
   c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:
111
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
   c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
   script/server:3

I have already tried:

gem install sqlite3

And got this response.

ERROR:  could not find gem sqlite3 locally or in a repository

I also tried:

gem install sqlite3-ruby

And got this response.

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
       ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/
sqlite3-ruby-1
.2.4 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/
ext/sqlite3_
api/gem_make.out

I am running Windows XP with XAMPP (Apache + MySQL + PHP).

How can I solve this?