sqlite3-ruby gem:无法构建gem原生扩展 [英] sqlite3-ruby gem: Failed to build gem native extension

查看:197
本文介绍了sqlite3-ruby gem:无法构建gem原生扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:查看此后续问题: 在Windows上的Gem更新 - 是否被破坏?






在Windows ,当我这样做时:

  gem install sqlite3-ruby 

我得到以下错误:

 构建原生扩展。这可能需要一段时间... 
错误:安装sqlite3-ruby时出错:
错误:无法构建gem本机扩展。

c:/ruby/bin/ruby.exe extconf.rb安装sqlite3-ruby --platform Win32
检查rt.lib中的fdatasync()... no
检查for sqlite3.h ... no

nmake
'nmake'不被识别为内部或外部命令,
可操作的程序或批处理文件。


Gem文件将保留安装在c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4中进行检查。
记录到c的结果:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

与hpricot gem 发生同样的事情。我似乎记得这些宝石安装在< 1.0宝石,但现在我在1.2.0上,事情变得棘手。



我也试过这个:

  gem install sqlite3-ruby --platform Win32 

不用说,这也不起作用(同样的错误)



有人知道这里发生了什么,以及如何解决这个问题?






更新:查看此后续问题: Windows上的Gem Update - 是否被破解?

sql 并获取以 sql ):

  $ gem list --remote --all sqlite 

*** REMOTE GEMS ***

sqlite(2.0.1,2.0.0,1.3.1,1.3.0,1.2.9.1,1.2.0,1.1.3,1.1.2,1.1.1,1.1 )
sqlite-ruby(2.2.3,2.2.2,2.2.1,2.2.0,2.1.0,2.0.3,2.0.2)
sqlite3-ruby(1.2.4,1.2 3,1.2.2,1.2.1,1.2.0,1.1.0,1.0.1,1.0.0,0.9.0,0.6.0,0.5.0)



然后您可以选择您想要安装的版本:

  gem install sqlite3-ruby -v 1.2.3 

要成功安装hpricot,我没有这:

  gem install hpricot -v 0.6 

令人烦恼的是,执行 gem update 会尝试将宝石更新为其最新的已破解的宝石, Windows,版本。当更新例程遇到错误时,它会将您排除在整个过程之外。有一个(哈克)解决这个问题 这里

那么,这个问题是否是宝石中的一个错误?宝石是否应该自动检测平台并安装最新的兼容版本?

Update: Check out this follow-up question: Gem Update on Windows - is it broken?


On Windows, when I do this:

gem install sqlite3-ruby

I get the following error:

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 install sqlite3-ruby --platform Win32
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.


Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

Same thing happens with the hpricot gem. I seem to remember these gems installed just fine on < 1.0 gems, but now I'm on 1.2.0, things have gone screwy.

I have also tried this:

gem install sqlite3-ruby --platform Win32

Needless to say, this doesn't work either (same error)

Does anyone know what is going on here and how to fix this?


Update: Check out this follow-up question: Gem Update on Windows - is it broken?

解决方案

As Nathan suggests, this does appear to be related to the fact that the latest versions of the sqlite3-ruby and hpricot gems don't appear to have Windows versions. Here's what to do when faced with this situation (note, the name of the gem is automatically wildcarded, so you can type just sql and get a list of all gems beginning with sql):

$ gem list --remote --all sqlite

*** REMOTE GEMS ***

sqlite (2.0.1, 2.0.0, 1.3.1, 1.3.0, 1.2.9.1, 1.2.0, 1.1.3, 1.1.2, 1.1.1, 1.1)
sqlite-ruby (2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2)
sqlite3-ruby (1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0.0, 0.9.0, 0.6.0, 0.5.0)

Then you can choose the version you would like to install:

gem install sqlite3-ruby -v 1.2.3

To successfully install hpricot, I did this:

gem install hpricot -v 0.6

Annoyingly, doing a gem update tries to update the gems to their latest, broken-on-Windows, versions. When the update routine encounters an error, it ditches you out of the whole process. There's a (hacky) solution to this problem here.

So, is this issue a bug in gems? Should gems not automatically detect the platform and install the latest compatible version?

这篇关于sqlite3-ruby gem:无法构建gem原生扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆