适用于Linux操作系统的Ruby 1.8.7的Nokogiri安装错误

时间:2014-05-07 07:02:23

标签: ruby-on-rails nokogiri authorize.net whm libxslt

我在Linux OS上使用Rails 3.2.1和ruby 1.8.7。 我正在尝试在WHM服务器上安装Nokogiri for Authorize-net gem。我收到以下错误:

gem install nokogiri -v '1.5.0'

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

        /usr/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... no
-----
libxslt 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.

mkmf.log文件指出缺少libxslt。

尝试安装libxslt-ruby时,我收到以下错误:

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

        /usr/bin/ruby extconf.rb
checking for ruby/io.h... no
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlXPtrNewRange() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
checking for xsltApplyStylesheet() in -lxslt... no
checking for xsltApplyStylesheet() in -llibxslt... no
checking for xsltApplyStylesheet() in -lxslt... no
*** 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.

mkmf.log文件声明:

have_header: checking for ruby/io.h... -------------------- no

"gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/local/include    -O2 -g -m64 -mtune=generic -Wall -fno-strict-aliasing  -fPIC    conftest.c -o conftest.i"
conftest.c:1:21: error: ruby/io.h: No such file or directory
checked program was:
/* begin */
1: #include <ruby/io.h>
/* end */

我正在Windows机器上开发,但客户端的服务器是Linux。我试过谷歌搜索但没有运气。

任何帮助都将受到高度赞赏!

提前致谢!

1 个答案:

答案 0 :(得分:1)

我认为“缺少libxslt”并不意味着您必须安装 gem libxslt-ruby。它告诉你安装 libxslt-dev。

只需关注http://nokogiri.org/tutorials/installing_nokogiri.html并运行:

sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri