【问题标题】:Install Nokogiri gem on OS X在 OS X 上安装 Nokogiri gem
【发布时间】:2014-01-01 22:54:19
【问题描述】:

尝试安装 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

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

我有:

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

谢谢!

【问题讨论】:

  • 你可以看看here提供的答案

标签: ruby macos gcc nokogiri


【解决方案1】:

您的 GCC 版本对我来说看起来不错。我在小牛队(看起来你在 Lion 上?),所以我的版本略有不同(x86_64-apple-darwin13.0.0 而不是 x86_64-apple-darwin12.5.0),但在其他方面与您发布的相同。

在我将 RVM 设置为默认使用 Ruby 1.9.3 而不是 1.9.2 之前,我遇到了 nokogiri 问题。但是,当我将 Vagrant 更新到 1.4.0 时,我的 nokogiri gem 被拉入,并且没有使用“gem install nokogiri”自行安装。我刚刚运行了“gem install nokogiri”,它对我来说没有错误地重建。

我建议执行以下操作:

  1. brew update #以防万一
  2. rvm 使用 ruby​​-1.9.3-p392
  3. rvm alias create default ruby​​-1.9.3-p392
  4. gem install nokogiri

【讨论】:

    猜你喜欢
    • 2015-03-19
    • 1970-01-01
    • 2014-06-17
    • 2014-12-25
    • 1970-01-01
    • 1970-01-01
    • 2013-11-03
    • 2012-03-08
    相关资源
    最近更新 更多