Error installing on Ubuntu 16.04 LTS

539 views
Skip to first unread message

Matheus Berkenbrock Nedel

unread,
Jul 11, 2016, 7:17:27 AM7/11/16
to nokogiri-talk
Hello, I'm having issues to compile Nokogiri. I've already went through the installation tutorial on Nokogiri website and dozens of stack exchange questions and other sites, but none of them seemed to fix my problem, so i decided to come here for help, I'm sorry if I am being ignorant of something.

I'm trying to install Ruby on Rails so I can continue to follow along with The Odin Project. I'm using this website to install Ruby on Rails: http://railsapps.github.io/installrubyonrails-ubuntu.html.
I'm using rvm and ruby-2.3.0 as default.

Here's the compiling error:

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

    current directory: /home/matheus/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/home/matheus/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160711-8981-g9imhg.rb extconf.rb
Using pkg-config version 1.1.7
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/matheus/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
 --help
 --clean
/home/matheus/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.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/matheus/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
 from /home/matheus/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:522:in `with_werror'
 from /home/matheus/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
 from extconf.rb:138:in `nokogiri_try_compile'
 from extconf.rb:162:in `block in add_cflags'
 from /home/matheus/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:629:in `with_cflags'
 from extconf.rb:161:in `add_cflags'
 from extconf.rb:414:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/matheus/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/matheus/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.8 for inspection.

Results logged to /home/matheus/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out




Here's the mkmf.log:

"gcc -o conftest -I/home/matheus/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/x86_64-linux -I/home/matheus/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/backward -I/home/matheus/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0 -I.     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wno-maybe-uninitialized  -fPIC  conftest.c  -L. -L/home/matheus/.rvm/rubies/ruby-2.3.0/lib -Wl,-R/home/matheus/.rvm/rubies/ruby-2.3.0/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R'/../lib' -lruby  -lpthread -lgmp -ldl -lcrypt -lm   -lc "
gcc: error trying to exec 'cc1': execvp: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }

/* end */


Thanks!

Mike Dalessio

unread,
Jul 11, 2016, 7:19:57 AM7/11/16
to nokogiri-talk
It appears as though you don't have a C compiler installed on your system. If you check out the installation tutorial for Ubuntu / Debian:


you'll see that it instructs users to install `build-essential`, among other things, which should take care of this dependency for you.

Good luck, and let me know if this doesn't solve your issue.


--
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 https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Matheus Berkenbrock Nedel

unread,
Jul 15, 2016, 12:05:05 PM7/15/16
to nokogiri-talk
I used apt-get upgrade and then gem install nokogiri, It installed successfully. I'm sorry, should have tried this before.
Reply all
Reply to author
Forward
0 new messages