使用bundler的山狮上的野村宝石的麻烦



我可以使用成功安装nokigiri

sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2  --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib

然而,当我运行"bundle install"时,我会遇到libxml2问题。我的问题是:如何通过bundler安装nokogiri?

这是我的"捆绑安装"输出:

Installing nokogiri (1.6.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
    /Users/philswenson/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2
Extracting libxml2-2.8.0.tar.gz into tmp/i686-apple-darwin11/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/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/i686-apple-darwin11/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/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxslt/1.1.26)...
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... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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/philswenson/.rvm/rubies/ruby-1.9.3-p448/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=${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
    --with-xml2lib
    --without-xml2lib

Gem files will remain installed in /Users/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0 for inspection.
Results logged to /Users/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.

有人能给我指正确的方向吗?

谢谢!

如果您使用的是RVM或类似的Ruby版本管理器,则不应该使用sudo

这适用于最新的Xcode CLT、mountain lion和mavericks以及nokogiri 1.6.1

临时解决方案0

正是nokogiri的补丁作为brew公式libxslt和libxml2

curl -L https://gist.githubusercontent.com/steakknife/8969368/raw/install_nokogiri_brew_osx.sh | bash

如果你不信任https管道到shell,这里是脚本的原始url。[gist-url]

速度更快,并且提供了一个已知良好的、仅keg的libiconv和nokogiri的libxml2和libxslt副本。系统libxml2未被触及。

临时解决方案1

这需要几分钟的时间,安装后会消耗掉100个MiB+。

gem install nokogiri

无论哪种方式,libxml2都需要变得更加稳定,或者它实际上是一个分叉,每个人都需要做更多的工作。

不要麻烦链接libxml2或libxslt,sudo任何东西,或者安装libiconv,这些都是不必要的,而且很脆弱。

相关内容

  • 没有找到相关文章