views:

28

answers:

1

The following error comes up:

C:\gem>gem install sqlite3-ruby --local
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 #include <sqlite3.h>
... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby/bin/ruby
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib


Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1
.3.0 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.0/ext/sqlite3/
gem_make.out

I have copied all the necessary files required in the Ruby/Bin folder, still it keeps reporting this error that sqlite3.h is missing.

Please do tell where do I have to place sqlite3.h, when I am installing the gem locally as you can see and I am currently using 1.3.0 version of SQLite3 for its installation. I have tried with the solutions that were posted for similar problems. And I am using Windows XP.

Thanks in advance.

+1  A: 

I had this problem. This is the solution I found. It's not very pretty, but it worked for me. In my case, I was using cygwin. There's probably a similar way to do it without using cygwin, but I don't know how.

1) Download the source of SQLite. I went for SQLite 3.6.23, somewhat arbitrarily, via this URL: http://www.sqlite.org/src/info/4ae453ea7b If that doesn't work, then go to the release timeline at http://www.sqlite.org/src/timeline?n=200&amp;t=release&amp;y=ci , choose a release, and download the ZIP file of it.

2) Unpack the ZIP archive somewhere. Go to that directory in cygwin. Execute these commands:

./configure
make
make sqlite3.dll
make install

3) Copy the sqlite3.exe and sqlite3.dll from the directory where make created them into somewhere on your path.

4) Once that's done, gem install sqlite3-ruby finally worked.

I was following this guide: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/240902

AlexC
Thanks it worked, but I had already shifted to Ubuntu and I didn't encountered any problem there, but it will be helpful for others..
Cody