SQLite3安装中的问题

时间:2010-07-05 13:00:29

标签: ruby-on-rails installation sqlite

出现以下错误:

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

我已经复制了Ruby / Bin文件夹中所需的所有必要文件,但它仍然报告了sqlite3.h缺失的错误。

当我在本地安装gem时,请告诉我在哪里放置sqlite3.h,我正在使用1.3.0版本的SQLite3进行安装。 我尝试过针对类似问题发布的解决方案。我正在使用Windows XP。

提前致谢。

4 个答案:

答案 0 :(得分:3)

我有这个问题。这是我找到的解决方案。它不是很漂亮,但它对我有用。就我而言,我使用的是cygwin。没有使用cygwin可能有类似的方法,但我不知道如何。

1)下载SQLite的。我通过这个URL去了SQLite 3.6.23,有点随意: http://www.sqlite.org/src/info/4ae453ea7b 如果这不起作用,请转到http://www.sqlite.org/src/timeline?n=200&t=release&y=ci的发布时间轴,选择一个版本,然后下载它的ZIP文件。

2)在某处解压缩ZIP存档。转到cygwin中的那个目录。执行以下命令:

  

./配置
  使
  make sqlite3.dll
  make install

3)将sqlite3.exe和sqlite3.dll从make创建它们的目录复制到路径上的某个位置。

4)一旦完成,gem install sqlite3-ruby终于奏效了。

我正在关注本指南:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/240902

答案 1 :(得分:2)

我知道这已经关闭了一段时间,但我遇到了同样的问题 帮助。安装apt-cyg。首先通过标准安装subversion和wget cygwin安装程序。然后运行以下命令:

wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin

现在使用apt-cyg安装sqlite3开发:

apt-cyg install libsqlite3-devel

最后

$ gem install sqlite3-ruby
Building native extensions.  This could take a while...
Fetching: sqlite3-ruby-1.3.3.gem (100%)

#######################################################

Hello! The sqlite3-ruby gem has changed it's name to just sqlite3.  Rather than
installing `sqlite3-ruby`, you should install `sqlite3`.  Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

<3 <3 <3 <3

#######################################################

Successfully installed sqlite3-1.3.6
Successfully installed sqlite3-ruby-1.3.3
2 gems installed
Installing ri documentation for sqlite3-1.3.6...
Installing ri documentation for sqlite3-ruby-1.3.3...
Installing RDoc documentation for sqlite3-1.3.6...
Installing RDoc documentation for sqlite3-ruby-1.3.3...

答案 2 :(得分:0)

我按照以下建议开展工作:http://www.skorks.com/2009/08/installing-and-using-sqlite-with-ruby-on-windows/

基本上,您可以从sqlite.org下载DLL和shell文件,并确保在已安装的每个ruby版本中将DLL复制到/bin目录中。您可以将shell文件放在系统路径中的某个位置,我有一个文件夹c:\bin。然后,您可以安装pik gem install sqlite3

答案 3 :(得分:-1)

替换为Gemfile.lock中的sqlite3(1.3.10-x64-mingw32)为我工作。