【问题标题】:'gem install nokogiri' fails in `bundle install` [Mac OS X Lion]'gem install nokogiri' 在 `bundle install` 中失败 [Mac OS X Lion]
【发布时间】:2012-04-02 22:47:09
【问题描述】:

系统:Mac OS X Lion

运行bundle install 告诉我这样做: gem install nokogiri -v '1.5.2'

Building native extensions.  This could take a while...
1ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

        /Users/ernsheong/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config.
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... no
checking for iconv_open() in -liconv... 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
compiling html_element_description.c
compiling html_entity_lookup.c
compiling html_sax_parser_context.c
compiling html_sax_push_parser.c
compiling nokogiri.c
compiling xml_attr.c
compiling xml_attribute_decl.c
compiling xml_cdata.c
compiling xml_comment.c
compiling xml_document.c
compiling xml_document_fragment.c
compiling xml_dtd.c
compiling xml_element_content.c
compiling xml_element_decl.c
compiling xml_encoding_handler.c
compiling xml_entity_decl.c
compiling xml_entity_reference.c
compiling xml_io.c
xml_io.c:28:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  return safe_len;
  ~~~~~~ ^~~~~~~~
1 warning generated.
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
compiling xml_node_set.c
compiling xml_processing_instruction.c
compiling xml_reader.c
compiling xml_relax_ng.c
compiling xml_sax_parser.c
compiling xml_sax_parser_context.c
compiling xml_sax_push_parser.c
compiling xml_schema.c
compiling xml_syntax_error.c
compiling xml_text.c
compiling xml_xpath_context.c
xml_xpath_context.c:189:30: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
  rb_raise(rb_eRuntimeError, message);
                             ^~~~~~~
1 warning generated.
compiling xslt_stylesheet.c
linking shared-object nokogiri/nokogiri.bundle
ld: warning: directory not found for option '-L/usr/local/Cellar/libxml2/2.7.8/lib'

make install
/usr/bin/install -c -m 0755 nokogiri.bundle /Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri
make: /usr/bin/install: No such file or directory
make: *** [/Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/nokogiri.bundle] Error 1


Gem files will remain installed in /Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2 for inspection.
Results logged to /Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out

它与OS X Lion, Attempting Nokogiri install - libxml2 is missingAn error occurred while installing nokogiri (1.5.2) 有点相似,但仍然不同

提前致谢。

【问题讨论】:

  • 你好像少了/usr/bin/install;你有安装 Xcode 吗? (我假设您会这样做,因为所有内容都已编译。不知道为什么您会错过...)
  • 我通过使用以下要点重新安装 ruby​​ 解决了这个问题:gist.github.com/1856859 一位朋友指出安装过程中的 --with-gcc=clang 选项对于 Lion/Snow Leopard 很重要
  • 继续为您自己的问题提供答案。它可能对其他人有帮助。

标签: ruby-on-rails nokogiri


【解决方案1】:

我通过使用以下要点重新安装 ruby​​ 解决了这个问题:gist.github.com/1856859。有朋友指出,安装时的 --with-gcc=clang 选项对 Lion/Snow Leopard 很重要

【讨论】:

    【解决方案2】:

    库存 ruby​​-1.9.3-p125 的 configre.in 中有一个小问题。您可以尝试使用 "Issue updating Ruby on Mac with Xcode 4.3.1"

    中提到的最新 RVM 负责人

    其他模块可能由于动态链接而失败。

    【讨论】:

      猜你喜欢
      • 2012-06-09
      • 2017-02-17
      • 1970-01-01
      • 2012-08-22
      • 2016-01-17
      • 1970-01-01
      • 2015-03-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多