在OS X上安装Nokogiri gem

时间:2022-11-09 00:15:49

Trying to install Nokogiri and I get the following error

试图安装Nokogiri,我收到以下错误

checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile

make
compiling html_document.c
cc1: error: -Werror=shorten-64-to-32: no option -Wshorten-64-to-32
make: *** [html_document.o] Error 1

I think I need to use a brew install gcc rather the one I have, but I can't remember how! :)

我想我需要使用brew安装gcc而不是我拥有的那个,但我不记得怎么做了! :)

I have:

我有:

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

thanks!

谢谢!

1 个解决方案

#1


0  

Your GCC version looks fine to me. I'm on Mavericks (and it looks like you're on Lion?), so my version is slightly different (x86_64-apple-darwin13.0.0 instead of x86_64-apple-darwin12.5.0) but otherwise identical to what you posted.

您的GCC版本对我来说很好。我在小牛队(看起来你好像在Lion?),所以我的版本略有不同(x86_64-apple-darwin13.0.0而不是x86_64-apple-darwin12.5.0),但与你发布的内容完全相同。

I had problems with nokogiri until I had RVM set to use Ruby 1.9.3 as the default instead of 1.9.2. My nokogiri gem was pulled in when I updated Vagrant to 1.4.0, though, and was not installed on its own with a "gem install nokogiri". I just ran a "gem install nokogiri" and it rebuilt without errors for me.

我有nokogiri的问题,直到我让RVM设置为使用Ruby 1.9.3作为默认值而不是1.9.2。当我将Vagrant更新到1.4.0时,我的nokogiri宝石已被拉入,并且没有单独安装“gem install nokogiri”。我只是跑了一个“宝石安装nokogiri”,它为我重建没有错误。

I'd recommend doing the following:

我建议你做以下事情:

  1. brew update # just in case
  2. brew更新#以防万一
  3. rvm use ruby-1.9.3-p392
  4. rvm使用ruby-1.9.3-p392
  5. rvm alias create default ruby-1.9.3-p392
  6. rvm别名创建默认的ruby-1.9.3-p392
  7. gem install nokogiri
  8. 宝石安装nokogiri

#1


0  

Your GCC version looks fine to me. I'm on Mavericks (and it looks like you're on Lion?), so my version is slightly different (x86_64-apple-darwin13.0.0 instead of x86_64-apple-darwin12.5.0) but otherwise identical to what you posted.

您的GCC版本对我来说很好。我在小牛队(看起来你好像在Lion?),所以我的版本略有不同(x86_64-apple-darwin13.0.0而不是x86_64-apple-darwin12.5.0),但与你发布的内容完全相同。

I had problems with nokogiri until I had RVM set to use Ruby 1.9.3 as the default instead of 1.9.2. My nokogiri gem was pulled in when I updated Vagrant to 1.4.0, though, and was not installed on its own with a "gem install nokogiri". I just ran a "gem install nokogiri" and it rebuilt without errors for me.

我有nokogiri的问题,直到我让RVM设置为使用Ruby 1.9.3作为默认值而不是1.9.2。当我将Vagrant更新到1.4.0时,我的nokogiri宝石已被拉入,并且没有单独安装“gem install nokogiri”。我只是跑了一个“宝石安装nokogiri”,它为我重建没有错误。

I'd recommend doing the following:

我建议你做以下事情:

  1. brew update # just in case
  2. brew更新#以防万一
  3. rvm use ruby-1.9.3-p392
  4. rvm使用ruby-1.9.3-p392
  5. rvm alias create default ruby-1.9.3-p392
  6. rvm别名创建默认的ruby-1.9.3-p392
  7. gem install nokogiri
  8. 宝石安装nokogiri