1

我正在尝试安装旧版本的 nokogiri,但我无法指定格式:

我在用着

gem install nokogiri -v 1.5.2 -- --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

但这不是正确的语法。你知道怎么做吗?

错误

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

        /Users/boris/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
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... no
-----
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:
4

2 回答 2

1

您只指定了lib要使用的目录,请尝试指定include目录:

gem install nokogiri -v 1.5.2 -- \
                 --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib \
                 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include

您可以同时指定两者:

gem install nokogiri -v 1.5.2 -- \
                 --with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1

看起来Nokogiriiconv在 1.5.2 和 1.5.5 版本之间的查找方式发生了一些变化,这可以解释为什么您能够安装最新版本但不能安装 1.5.2。

于 2012-10-09T22:37:12.370 回答
0

我只是安装了自制软件,并使用它brew link inconv来创建必要的符号链接来编译 gem。

$brew link libiconv
Linking /usr/local/Cellar/libiconv/1.13.1... 18 symlinks created
$gem install nokogiri -v 1.5.2 
于 2012-10-10T18:43:42.087 回答