sqlite3-ruby: Unable to install sqlite3 for Ruby2.0.0 on Windows 7

C:\Ruby200\DevKit>gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb
checking for 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-sqlite3-lib=${sqlite3-dir}/
        --enable-local
        --disable-local


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1
.3.7 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/
gem_make.out

and

C:\Ruby200\DevKit>gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.0
  - RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby200/lib/ruby/gems/2.0.0
  - RUBY EXECUTABLE: C:/Ruby200/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby200/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby200/lib/ruby/gems/2.0.0
     - C:/Users/yy/.gem/ruby/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

About this issue

  • Original URL
  • State: closed
  • Created 14 years ago
  • Reactions: 2
  • Comments: 26 (11 by maintainers)

Most upvoted comments

solved with

http://www.sqlite.org/download.html dl -> sqlite-amalgamation -> sqlite-dll-win32-x86

and extract same:

-include –sqlite3.h –sqlite3ext.h -lib –shell.c –sqlite3.c -sqlite3.def -sqlite3.dll

and install gem

gem install sqlite3 --platform=ruby – --with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_to_dll

it works for me

@yuumi3 looks like you don’t have the sqlite3 headers and libs that are required to install sqlite3 gem from source.

The pre-compiled binary for x86-mingw32 do not include binaries for Ruby 2.0, so I guess you installed with --platform=ruby.

You should obtain the headers and libraries for sqlite3 and use build arguments:

gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=C:/path/to/sqlite3

Where C:/path/to/sqlite3 is where the headers (include) and libs (lib) for sqlite3 are extracted.

Hope that helps.

I’ve figured out how to install the sqlite3 gem in windows. You must compile sqlite3 manually to a “.a” library file using msys from the rubyinstall devkit.

Download the sqlite3 autoconf from sqlite’s site.

Compile the source code with .configure, make, and make install.

Go into the .libs directory, copy and paste the libsqlite3.a to your sqlite3 directory.

Then do gem install sqlite3 --platform=ruby – --with-sqlite3-dir=[sqlite3 directory].

I ended up extracting everything to my sqlite3 directory to make sure I had everything – the .exe shell, the .dll, the source, all of it.

Thanks luislavena,

I built sqlite3 library by mingw32.

bash-3.1$ ls -l c:/sqlite3/lib
total 4347
-rw-r--r-- 1 yy Administrators 4313628 Feb 26 21:49 libsqlite3.a
-rw-r--r-- 1 yy Administrators  135652 Feb 26 21:49 libsqlite3.dll.a
-rw-r--r-- 1 yy Administrators     788 Feb 26 21:49 libsqlite3.la
drwxr-xr-x 2 yy Administrators       0 Feb 26 21:50 pkgconfig
bash-3.1$ ls -l c:/sqlite3/include
total 360
-rw-r--r-- 1 yy Administrators 343763 Feb 26 21:50 sqlite3.h
-rw-r--r-- 1 yy Administrators  24158 Feb 26 21:50 sqlite3ext.h

and tried gem install, but failed again. Do you have any suggestions ?

C:\Users\yy>gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=c:/sqlite3
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-sqlite3-dir=c:/sqlite3'
This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.
    C:/Ruby200/bin/ruby.exe extconf.rb --with-sqlite3-dir=c:/sqlite3
checking for sqlite3.h... yes
checking for sqlite3_libversion_number()... -lsqlite3
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***