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

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

问题描述

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

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

在 Windows 上,当我这样做时:

On Windows, when I do this:

gem install sqlite3-ruby

我收到以下错误:

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

hpricot gem 也会发生同样的事情.我似乎记得这些 gem 在 < 上安装得很好.1.0 gems,但现在我在 1.2.0,事情变得很糟糕.

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.

我也试过这个:

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?

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

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

推荐答案

正如 Nathan 所暗示的,这似乎与最新版本的 sqlite3-ruby 和 hpricot gem 似乎没有 Windows 版本有关.这是遇到这种情况时应该做的事情(注意,gem 的名称会自动使用通配符,因此您只需键入 sql 并获取以 sql):

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

为了成功安装 hpricot,我这样做了:

To successfully install hpricot, I did this:

gem install hpricot -v 0.6

令人讨厌的是,执行 gem update 会尝试将 gem 更新到其最新的、已损坏的 Windows 版本.当更新例程遇到错误时,它会将您排除在整个过程之外.这个问题有一个(hacky)解决方案这里.

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.

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

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

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