Nokogiri 无法构建 gem 本机扩展 (RuntimeError)



我正在尝试使用以下方法安装Nokogiri:

sudo gem install nokogiri

这是安装后的混乱:

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
  ERROR: Failed to build gem native extension.
        /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.0.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Users/micahsherman/.rvm/gems/ruby-1.9.3-p429/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin13.0.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /Users/micahsherman/.rvm/gems/ruby-1.9.3-p429/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxslt/1.1.26)...
checking for libxml/parser.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
Provided configuration options:
  --with-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
  --with-zlib-dir
  --without-zlib-dir
  --with-zlib-include
  --without-zlib-include=${zlib-dir}/include
  --with-zlib-lib
  --without-zlib-lib=${zlib-dir}/lib
  --with-iconv-dir
  --without-iconv-dir
  --with-iconv-include
  --without-iconv-include=${iconv-dir}/include
  --with-iconv-lib
  --without-iconv-lib=${iconv-dir}/lib
  --with-xml2-dir
  --without-xml2-dir
  --with-xml2-include
  --without-xml2-include=${xml2-dir}/include
  --with-xml2-lib
  --without-xml2-lib=${xml2-dir}/lib
  --with-xslt-dir
  --without-xslt-dir
  --with-xslt-include
  --without-xslt-include=${xslt-dir}/include
  --with-xslt-lib
  --without-xslt-lib=${xslt-dir}/lib
  --with-libxslt-config
  --without-libxslt-config
  --with-pkg-config
  --without-pkg-config
  --with-libxml-2.0-config
  --without-libxml-2.0-config
  --with-libiconv-config
  --without-libiconv-config
/Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
  from /Users/micahsherman/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
  from extconf.rb:166:in `<main>'

Gem files will remain installed in /Users/micahsherman/.rvm/gems/ruby-1.9.3-p429/gems/nokogiri-1.6.0 for inspection.
Results logged to /Users/micahsherman/.rvm/gems/ruby-1.9.3-p429/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out

我将不胜感激一些提示或建议。 我正在使用Ruby 1.9.4,Rails 3.2.13,我不知道为什么这不起作用。 我正在使用小牛队,我认为这可能是问题所在。

我已经更新了 xcode 等。

这不是一个直接的解决方案,而是让你朝着正确的方向前进。 rvm在解决自己的问题方面非常扎实。请按照以下步骤操作,帮助rvm发挥其魔力

运行rvm requirements以查找缺少的内容。

使用rvm pkg(在旧版本的 RVM 上)或rvm autolibs安装缺少的包。

确保您阅读了在此过程中要求您阅读的所有文档rvm

成功完成后,请尝试安装 nokogiri

相关内容

  • 没有找到相关文章

最新更新