0

I am working with Rails 3.2.1 and ruby 1.8.7 on Linux OS. I am trying to install Nokogiri for Authorize-net gem on a WHM Server. I am getting the following error :

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.

The mkmf.log file states that libxslt is missing.

When trying to install libxslt-ruby, I'm getting the following error :

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.

The mkmf.log file states :

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 */

I am developing on Windows machine but the client's server is Linux. I tried googling but no luck.

Any help would be highly appreciated!

Thanks in advance!

user3445812
  • 1
  • 1
  • 4
  • Have you tried following this guide? http://nokogiri.org/tutorials/installing_nokogiri.html under section ubuntu – Dax May 07 '14 at 07:23

1 Answers1

1

I think "libxslt is missing" doesn't mean you have to install gem libxslt-ruby. It's telling you to install package libxslt-dev.

Just follow http://nokogiri.org/tutorials/installing_nokogiri.html and run:

sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
Jun Zhou
  • 3,060
  • 1
  • 20
  • 31
  • I've tried the above code but it says : `sudo apt-get install libxslt-dev libxml2-dev -bash: sudo: command not found` . – user3445812 May 07 '14 at 08:10
  • @user3445812 Do you get root access then? – Jun Zhou May 07 '14 at 22:14
  • The cpanel of WHM Server shows this notice : "Warning! You are logged in with the reseller or root password." But Still I get "sudo not found" message. – user3445812 May 09 '14 at 04:51
  • @user3445812 You are logged in as root. So you didn't need sudo. However, logging in as root isn't a good idea. – Jun Zhou May 09 '14 at 07:32
  • The linked page (at time of writing) does not suggest running 'gem install' with sudo. I wouldn't recommend it either. – mwfearnley Oct 28 '16 at 11:25