在 Mac OS X 10.5.8 中安装 Nokogiri gem 时出现问题

发布于 2025-01-06 09:28:07 字数 2610 浏览 0 评论 0原文

我正在尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沙沙粒小 2025-01-13 09:28:08

根据以下说明:http://nokogiri.org/tutorials/installing_nokogiri.html 您需要use:

brew install libxml2 libxslt
brew link libxml2 libxslt

那么

gem install nokogiri

你使用了那些还是只使用了brew install libxml2?

Per the directions at: http://nokogiri.org/tutorials/installing_nokogiri.html you needed to use:

brew install libxml2 libxslt
brew link libxml2 libxslt

then

gem install nokogiri

Did you use those or only brew install libxml2?

如果没有 2025-01-13 09:28:08

确保没有可用的 Nokogiri 版本:

use gem uninstall nokogiri

首先安装 Xcode 的命令行工具。请参阅“如何在 Mac OS X 10.8 / Xcode 4.4 上使用/安装 gcc”。

然后运行以下命令:

brew install libxml2
gem install nokogiri

现在效果很好,我尝试了一下。

Make sure there is no Nokogiri version available:

use gem uninstall nokogiri

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:

brew install libxml2
gem install nokogiri

Now it works well, I tried it.

暮倦 2025-01-13 09:28:08
brew install libxml2 libxslt
gem install nokogiri -- \
    --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.x/lib \
    --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.xx \
    --with-iconv-lib=/usr/lib \
    --with-iconv-include=/usr/local/include
brew install libxml2 libxslt
gem install nokogiri -- \
    --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.x/lib \
    --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.xx \
    --with-iconv-lib=/usr/lib \
    --with-iconv-include=/usr/local/include
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文