installation issues with Ubuntu 14.04

662 views
Skip to first unread message

Simon Ritchie

unread,
Aug 17, 2015, 6:58:01 AM8/17/15
to nokogiri-talk
The installation instructions (http://www.nokogiri.org/tutorials/installing_nokogiri.html) describe how to install this gem, but there seems to be a missing step for ubuntu (14.04).  I found I had to install ruby-dev first:

    sudo apt-get install ruby-dev

Without that step, installation fails at the compilation stage, probably due to missing headers.  It' impossible to figure out what's wrong from the error message, in fact there are many potential causes, which can lead to many hours of fruitless experimentation. 

Rails now depends on nokogiri - if you try to install rails it installs nokogiri and fails at the same point, so this is a show-stopper for new installations of rails under the current Ubuntu.

Also, I understand that nokogiri can only be installed using certain versions of ruby - I installed the latest Ruby (2.2.2) from source and than had to roll it back to 1.9 to install nokogiri.

Can the installation instructions be updated to cover these issues?

Simon

Mike Dalessio

unread,
Aug 17, 2015, 7:09:57 AM8/17/15
to nokogiri-talk


On Aug 17, 2015 6:58 AM, "Simon Ritchie" <simonri...@gmail.com> wrote:
>
> The installation instructions (http://www.nokogiri.org/tutorials/installing_nokogiri.html) describe how to install this gem, but there seems to be a missing step for ubuntu (14.04).  I found I had to install ruby-dev first:
>
>     sudo apt-get install ruby-dev
>
> Without that step, installation fails at the compilation stage, probably due to missing headers.  It' impossible to figure out what's wrong from the error message, in fact there are many potential causes, which can lead to many hours of fruitless experimentation. 

It honestly has never occurred to me that people would not have Ruby development tools installed. `ruby-dev` or equivalent is required to build C extensions, and so I'll unhelpfully assert that whatever tutorial you're following for installing Ruby is lacking appropriate information.

That said, I'll go update the docs now, because this just happened.

>
> Rails now depends on nokogiri - if you try to install rails it installs nokogiri and fails at the same point, so this is a show-stopper for new installations of rails under the current Ubuntu.
>
> Also, I understand that nokogiri can only be installed using certain versions of ruby - I installed the latest Ruby (2.2.2) from source and than had to roll it back to 1.9 to install nokogiri.

This is patently false (for non-Windows platforms). If you are having issues installing Nokogiri, please start a new thread on this mailing list with details including your mkmf.log file.

Where did you hear this information?

>
> Can the installation instructions be updated to cover these issues?
>
> Simon
>

> --
> You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.
> To post to this group, send email to nokogi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nokogiri-talk.
> For more options, visit https://groups.google.com/d/optout.

Mike Dalessio

unread,
Aug 17, 2015, 7:48:58 AM8/17/15
to nokogiri-talk
On Mon, Aug 17, 2015 at 5:07 AM, Simon Ritchie <simonri...@gmail.com> wrote:
The installation instructions (http://www.nokogiri.org/tutorials/installing_nokogiri.html) describe how to install this gem, but there seems to be a missing step for ubuntu (14.04).  I found I had to install ruby-dev first:

    sudo apt-get install ruby-dev

Without that step, installation fails at the compilation stage, probably due to missing headers.  It' impossible to figure out what's wrong from the error message, in fact there are many potential causes, which can lead to many hours of fruitless experimentation. 


Please keep in mind that this documentation site is completely open-sourced and you're free to send PRs for things you think are missing. Information is noted in the footer of each page of the site.
 

Rails now depends on nokogiri - if you try to install rails it installs nokogiri and fails at the same point, so this is a show-stopper for new installations of rails under the current Ubuntu.

Also, I understand that nokogiri can only be installed using certain versions of ruby - I installed the latest Ruby (2.2.2) from source and than had to roll it back to 1.9 to install nokogiri.

Can the installation instructions be updated to cover these issues?

Simon

--

Prasanna Moharana

unread,
Sep 14, 2015, 9:26:40 AM9/14/15
to nokogiri-talk


Hello am new to Ruby and when i try to install rails this issue occurs

ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /home/prasanna/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150914-5922-18uxw0j.rb extconf.rb
checking if the C compiler accepts ... *** 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
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/prasanna/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/home/prasanna/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /home/prasanna/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
    from /home/prasanna/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
    from /home/prasanna/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
    from extconf.rb:80:in `nokogiri_try_compile'
    from extconf.rb:87:in `block in add_cflags'
    from /home/prasanna/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
    from extconf.rb:86:in `add_cflags'
    from extconf.rb:337:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/prasanna/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /home/prasanna/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out

PS. I have already tried out
sudo apt-get install libmagickwand-dev
gem update --system
sudo apt-get install ruby-dev
 sudo apt-get install mkmf
but till now no result.

Mike Dalessio

unread,
Sep 14, 2015, 9:31:10 AM9/14/15
to nokogiri-talk
This error:

The compiler failed to generate an executable file.

generally means you don't have your development tools installed.

Please read the installation tutorial at


and in particular make sure you've run this command correctly, and that it succeeded:

> sudo apt-get install ruby-dev zlib1g-dev

If that doesn't work, you'll need to provide more information about your system and your failures, including the log file referenced in your error output, `mkmf.log`.




--

Lars Kanis

unread,
Sep 14, 2015, 1:02:10 PM9/14/15
to nokogi...@googlegroups.com

This is probably because of a missing dependency in RVM, already filed here: https://github.com/rvm/rvm/issues/3509#issuecomment-139915004

Try
    sudo apt-get install libgmp-dev
to install this dependency.
--
Regards,
Lars

Reply all
Reply to author
Forward
0 new messages