使用配置选项安装特定的gem版本

时间:2022-04-08 07:00:20

I'm trying to install an old version of nokogiri, but I am having trouble specifying the format:

我正在尝试安装旧版本的nokogiri,但我在指定格式时遇到问题:

I'm using

我在用着

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

but this is not the correct syntax. Do you know how to do this?

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

ERROR

错误

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:

2 个解决方案

#1


1  

You’ve only specified the lib dir to use, try specifying the include dir as well:

您只指定了要使用的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

You may be able to specify both together:

您可以将两者一起指定:

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

It looks like there was some changes as to how Nokogiri finds iconv between versions 1.5.2 and 1.5.5, which may explain why you’re able to install the latest version but not 1.5.2.

看起来Nokogiri如何在版本1.5.2和1.5.5之间找到iconv有一些变化,这可以解释为什么你能够安装最新版本而不是1.5.2。

#2


0  

I simply installed homebrew, and used the brew link inconv to create the necessary symlinks to compile the gem.

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

$brew link libiconv
Linking /usr/local/Cellar/libiconv/1.13.1... 18 symlinks created
$gem install nokogiri -v 1.5.2 

#1


1  

You’ve only specified the lib dir to use, try specifying the include dir as well:

您只指定了要使用的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

You may be able to specify both together:

您可以将两者一起指定:

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

It looks like there was some changes as to how Nokogiri finds iconv between versions 1.5.2 and 1.5.5, which may explain why you’re able to install the latest version but not 1.5.2.

看起来Nokogiri如何在版本1.5.2和1.5.5之间找到iconv有一些变化,这可以解释为什么你能够安装最新版本而不是1.5.2。

#2


0  

I simply installed homebrew, and used the brew link inconv to create the necessary symlinks to compile the gem.

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

$brew link libiconv
Linking /usr/local/Cellar/libiconv/1.13.1... 18 symlinks created
$gem install nokogiri -v 1.5.2