【发布时间】:2014-07-29 03:08:40
【问题描述】:
我正在尝试通过 RVM 在 Yosemite 上安装 Ruby on Rails。但是,当我尝试运行“捆绑安装”时,似乎一切正常,但出现了与 Nokogiri 相关的错误:
pauls-air:~ paulmcguane$ 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.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Building native extensions with: '--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.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib'
This could take a while...
Building nokogiri using packaged libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
错误信息是:
/Users/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv 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/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
【问题讨论】:
-
您可能应该让 nokogiri 使用其捆绑版本的 lib xml,而不是强制使用您已安装的版本(尽管看起来它可能会这样做)此外应该在带有精确编译错误的日志文件的错误消息。
-
尚未在优胜美地上安装。但我会从新的 gemset 重新开始,并确保 Nokogiri 在 rails(或任何其他 gem)之前列出。这可以确保 Nokogiri 使用其嵌入式 libxml2(这可以防止您遇到第一个孩子的问题)。另见github.com/sparklemotion/nokogiri/issues/… 和github.com/sparklemotion/nokogiri/issues/829
-
你可以试试这个答案:stackoverflow.com/questions/24091869/…
标签: ruby-on-rails nokogiri homebrew osx-yosemite