【发布时间】:2012-03-08 10:18:05
【问题描述】:
我正在尝试在 OS X Leopard (10.5.8) 中的 RVM 管理的 Ruby 1.8.7 安装下安装 Nokogiri gem。
我收到以下错误:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
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()... no
-----
The function 'xmlHasFeature' is missing from your installation of libxml2. Likely this means that your installed version of libxml2 is old enough that nokogiri will not work well. To get around this problem, please upgrade your installation of libxml2.
Please visit http://nokogiri.org/tutorials/installing_nokogiri.html for more help!
*** extconf.rb failed ***
我通过 homebrew (brew install libxml2) 安装了最新的 libxml2,所以我不知道还能尝试什么。
更新:
我尝试了 Nokogiri 网站上的说明,但无法让 Nokogiri gem 安装识别 libxml2。
根据the instructions 我通过自制软件安装并链接了 libxml2 和 libxslt:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
错误信息已更改,但Nokogiri安装抱怨缺少libxml2:
...
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... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies
安装的libxml2版本是2.7.8。
更新更新:
我尝试从 homebrew 安装 iconv 库,看看是否可以解决错误checking for iconv_open() in iconv.h... no,所以我运行了命令:
brew install libiconv
brew link libiconv
完成安装后,我尝试再次安装 nokogiri gem,以获取此错误消息,安装程序现在抱怨 libiconv 丢失
hecking 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... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
我一无所知。
【问题讨论】:
标签: ruby rubygems rvm nokogiri osx-leopard