无法在Windows PC上安装dm-sqlite-adapter Gem

时间:2013-09-15 08:33:12

标签: ruby-on-rails ruby sqlite

我是Ruby / Sinatra的新手,我正在尝试安装DataMapper SQLite适配器。当我运行gem install dm-sqlite-adapter时,我收到以下消息。我之前使用命令gem install sqlite3安装了sqlite3。但是,如果我尝试拨打gem install sqlite3 --platform=ruby,我会收到错误。

  c:\Ruby_Dev_Kit>gem install dm-sqlite-adapter
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing dm-sqlite-adapter:
        ERROR: Failed to build gem native extension.

    C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for sqlite3.h... no
*** 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
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby200-x64/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}/


Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/do_sq
lite3-0.10.13 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/do_sqlite3-0.10.13/ext
/do_sqlite3/gem_make.out

我尝试了多种不同的方法来解决这个问题。我能够安装Ruby Development Kit,因为我能够安装JSON gem。同样,我从SQLite.org下载了SQLite源代码,但我无法弄清楚如何正确配置工具找到的合并的所有方面。以下是mkmf.log的值:

have_header: checking for sqlite3.h... -------------------- no

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -I/usr/local/include -I/opt/local/include -I/usr/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wall  -DHAVE_NO_DATETIME_NEWBANG conftest.c  -L. -LC:/Ruby200-x64/lib -L/usr/local/ -L/opt/local/ -L/usr/ -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

"x86_64-w64-mingw32-gcc -E -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -I/usr/local/include -I/opt/local/include -I/usr/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wall  -DHAVE_NO_DATETIME_NEWBANG  conftest.c -o conftest.i"
conftest.c:5:21: fatal error: sqlite3.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/* end */

--------------------

我尝试了许多不同的东西来使它工作,我意识到这可能是一个愚蠢的问题。但是,在这一点上,我没有想法。任何帮助都会非常感激。

系统信息:

  • Windows 7 64位
  • Ruby版本:2.0.0 p247 x64
  • 安装程序 - 标准Ruby Exe安装程序

1 个答案:

答案 0 :(得分:2)

我最终能够解决这个问题。对于那些在未来遇到这种情况的人来说,Bosko Ivanisevic写了一篇很好的指南,告诉他们如何解决这个问题。

见这里:http://rubyonwindowsguides.github.io/book/ch02-05.html

在那里要注意许多细节,所以一定要逐步阅读并完全遵循一切。很好的解释。

相关问题