0

I recently reinstalled rbenv as it helped with other issues. Now I receive a completly new issue with a particular project.

Similar to issue already posted: nokogiri - ERROR: Failed to build gem native extension and nokogiri will not install - ERROR: Failed to build gem native extension I have attempted several of their solutions, but no luck.

Here is my condensed error :

|11:11:05| ~ bundle install
Fetching source index from https://rubygems.org/
Using rake 10.3.2
Using Ascii85 1.0.2
Using i18n 0.6.9
...
Using callsite 0.0.11
Using cancan 1.6.10
Using mini_portile 0.5.2


Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

    bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

Password:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.2.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /private/var/folders/mp/tl8cpc_j0vd504t3npnqxzl00000gn/T/bundler20140627-949-55sx95/nokogiri-1.6.1/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.2.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin13.2.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /private/var/folders/mp/tl8cpc_j0vd504t3npnqxzl00000gn/T/bundler20140627-949-55sx95/nokogiri-1.6.1/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.2.0/libxslt/1.1.26)...
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.
-----
*** 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:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
...
    --without-iconvlib
    --with-xml2lib
    --without-xml2lib

extconf failed, exit code 1

Gem files will remain installed in /var/folders/mp/tl8cpc_j0vd504t3npnqxzl00000gn/T/bundler20140627-949-55sx95/nokogiri-1.6.1/gems/nokogiri-1.6.1 for inspection.
Results logged to /var/folders/mp/tl8cpc_j0vd504t3npnqxzl00000gn/T/bundler20140627-949-55sx95/nokogiri-1.6.1/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.1/gem_make.out
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
|11:15:49| ~ sudo gem install nokogiri -v '1.6.1'
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.2.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.2.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin13.2.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.2.0/libxslt/1.1.26)...
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.
-----
*** 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:
    --with-opt-dir
...
    --with-xml2lib
    --without-xml2lib

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.1/gem_make.out

My complete error message is here: http://pastebin.com/4QmXL9e1

As some of the answers in the question gem install nokogiri -v '1.5.9', sudo port upgrade libxml2 libxslt

Ruby

sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8
sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby

nokogiri

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

Here is some info my ruby versions and other system info http://pastebin.com/fcWDTiq9

Community
  • 1
  • 1
Beast_Code
  • 3,097
  • 12
  • 43
  • 54

2 Answers2

0

If you are using centos then install this:

yum install libxslt-devel libxml2-devel
Ahmad Hussain
  • 2,443
  • 20
  • 27
0

For me. In elementary os 5 juno works with... installing ruby 1.8

sudo apt-get install ruby1.8

and then install nokogiri 1.8.5

sudo apt-get install nokogiri -v '1.8.5'
Edmundo
  • 11
  • 1