3

我是 Ruby/Sinatra 的新手,我正在尝试安装 DataMapper SQLite 适配器。当我运行时,gem install dm-sqlite-adapter我收到以下消息。我之前确实使用命令安装了 sqlite3 gem install 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 开发工具包,因为我能够安装 JSON gem。同样,我从SQLite.org下载了 SQLite 源代码,但我无法弄清楚如何正确配置该工具可以找到的合并的所有方面。下面是mkmf.log's 的值:

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 */

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

我尝试了很多不同的方法来让它工作,我意识到这可能是一个愚蠢的问题。但是,在这一点上,我没有想法。任何帮助将不胜感激。

系统信息:

  • 视窗 7 64 位
  • 红宝石版本:2.0.0 p247 x64
  • 安装程序 - 标准 Ruby Exe 安装程序
4

1 回答 1

2

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

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

那里的许多细节要小心,因此请务必逐步通读并准确遵循所有内容。很好的解释。

于 2013-09-15T21:23:26.580 回答