在 Mac OS X 10.5.8 中安装 Nokogiri gem 时出现问题
我正在尝试在 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 安装了最新的 libxml2 (brew install libxml2),所以我不知道还能尝试什么。
更新:
我尝试了 Nokogiri 网站上的说明,但无法让 Nokogiri gem 安装识别 libxml2。
按照说明 我通过自制程序安装并链接了 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。
更新更新:
我尝试从自制程序安装 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.
-----
我一无所知。
I'm trying to install the Nokogiri gem under an RVM managed Ruby 1.8.7 installation in OS X Leopard (10.5.8).
I'm getting the following error:
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 ***
I have the latest libxml2 installed via homebrew (brew install libxml2), so I don't know what else to try.
Update:
I tried the instructions from the Nokogiri website and I can't get the Nokogiri gem installation to recognize libxml2.
Per the instructions
I installed and linked libxml2 and libxslt via homebrew:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
The error message has changed, but the Nokogiri installation complains that libxml2 is missing:
...
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
The installed libxml2 version is 2.7.8.
Update update:
I tried installing the iconv library from homebrew to see if I could solve the error checking for iconv_open() in iconv.h... no
, so I ran the commands:
brew install libiconv
brew link libiconv
And after finishing the installation, I tried to install the nokogiri gem again, to get this error message, where the installer now complains that libiconv is missing
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.
-----
I'm clueless.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据以下说明:http://nokogiri.org/tutorials/installing_nokogiri.html 您需要use:
那么
你使用了那些还是只使用了brew install libxml2?
Per the directions at: http://nokogiri.org/tutorials/installing_nokogiri.html you needed to use:
then
Did you use those or only
brew install libxml2
?确保没有可用的 Nokogiri 版本:
首先安装 Xcode 的命令行工具。请参阅“如何在 Mac OS X 10.8 / Xcode 4.4 上使用/安装 gcc”。
然后运行以下命令:
现在效果很好,我尝试了一下。
Make sure there is no Nokogiri version available:
First install the command-line tool for Xcode. Refer to "How to use/install gcc on Mac OS X 10.8 / Xcode 4.4".
Then run the following commands:
Now it works well, I tried it.