0

I know that there are many similar questions out there but none of their answers help me out with this. I used to install it without any problem before, after 6 months, I tried to bundle install again and it fail.

This is what i got, looks like the same as other people:

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

    /home/ubuntu/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160625-23682-1ebh39x.rb extconf.rb --use-system-libraries
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/ubuntu/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/home/ubuntu/.rvm/rubies/ruby-2.2.1/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/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
    from /home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
    from /home/ubuntu/.rvm/rubies/ruby-2.2.1/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/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
    from extconf.rb:86:in `add_cflags'
    from extconf.rb:336:in `<main>'

extconf failed, exit code 1

And the mkmf.log is:

"gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.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  -fPIC  conftest.c  -L. -L/home/ubuntu/.rvm/rubies/ruby-2.2.1/lib -Wl,-R/home/ubuntu/.rvm/rubies/ruby-2.2.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R'/../lib' -lruby  -lpthread -ldl -lcrypt -lm   -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

As I can see in the mkmf.log, it tells nothing about errors which is different to other questions I found on StackOverflow.

I installed all the dependencies that I know or mentioned on the Internet such as libxml2, libxml2-dev, libxslt-dev, ruby-dev, zlib1g-dev, liblzma-dev, libgmp-dev, patch.

I'm pretty much lost because I didn't do anything rather than trying to move all of my code and deployment assets to other directory. What I did exactly is that I registered new ESB and mounted it into the instance then I make a symlink to map my current path to that mount point.

Edit 1: I actually can install via gem gem install nokogiri -v '1.6.7' successfully. However bundle install fails.

vutran
  • 2,145
  • 21
  • 34
  • Possible duplicate of [How to install Nokogiri Ruby gem with mkmf.log saying libiconv not found?](http://stackoverflow.com/questions/12336160/how-to-install-nokogiri-ruby-gem-with-mkmf-log-saying-libiconv-not-found) – dan-klasson Jun 25 '16 at 10:42
  • I can see in many other questions that `mkmf.log` actually shows an error, however in my case, i dont see any errors in `mkmf.log` – vutran Jun 25 '16 at 10:44
  • Did you try the solution though? – dan-klasson Jun 25 '16 at 10:46
  • I installed all of the lib mentioned in that solution and it stays the same. However, I can install directly with `gem` without any problem but with `bundle`, it still fails. – vutran Jun 25 '16 at 10:49
  • In your Gemfile you just specify `gem 'nokogiri'`? – dan-klasson Jun 25 '16 at 10:52
  • No, I believe that nokogiri is required by Rails. – vutran Jun 25 '16 at 14:40

0 Answers0