2

I am trying to install Rails. I installed RVM, then the latest Ruby version via it (it works), but installing Rails fails this way:

serge1peshcoff@myLaptop:~$ gem install rails
Building native extensions.  This could take a while...
/home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /allext/soft_without_install in PATH, mode 040777
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150911-21759-1c3q6e9.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
*** 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/serge1peshcoff/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
/home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-linux/digest/md5.so: undefined symbol: rb_Digest_MD5_Init - /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-linux/digest/md5.so (LoadError)
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.1/gems/mini_portile-0.6.2/lib/mini_portile.rb:7:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from extconf.rb:395:in `<main>'

extconf failed, exit code 1

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

I searched the internet for the answer, but I found nothing like that. I tried to install libssl-dev, which was the cause in one situation, it did nothing. The other answer said to run rvm requirements to know what isn't installed, I tried this too, but it didn't work either. So I'm completely lost. Does anyone know how to fix it?

UPD: I installed nokigiri via gem install nokogiri --use-system-libraries, it installed without errors, however I am still facing the same error while running Rails, like this:

serge1peshcoff@myLaptop:/all/Documents/Programming/rails$ rails
/home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/x86_64-linux/digest/md5.so: undefined symbol: rb_Digest_MD5_Init - /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/x86_64-linux/digest/md5.so (LoadError)
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/generators/app_base.rb:1:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:1:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/commands/application.rb:2:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/cli.rb:14:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/bin/rails:9:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/rails:23:in `load'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/rails:23:in `<main>'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
serge1peshcoff
  • 4,342
  • 11
  • 45
  • 76

2 Answers2

2

This related to the nokogiri issue reported in this question

There are some additional linux libraries required to compile it.

Community
  • 1
  • 1
The Fabio
  • 5,369
  • 1
  • 25
  • 55
  • I installed `nokogiri` via running `gem install nokogiri --use-system-libraries` and then `gem install rails`, everything was fine, then I started Rails and I got this error about "undefined symbol: rb_Digest_MD5_Init" (the same as when installing), even when I run it without arguments – serge1peshcoff Sep 11 '15 at 20:36
  • how about this answer : "http://stackoverflow.com/questions/3545118/faulty-ruby-compilation-with-rvm-getting-undefined-symbol-rb-digest-md5-init" – The Fabio Sep 12 '15 at 11:50
  • tried it before posting this question: I don't have `libreadline5-dev` in my repository (though I have replace packages, I installed one of those) and also I tried to reinstall `libssl-dev` (I read that it can be the issue) and still I have the same result. – serge1peshcoff Sep 12 '15 at 21:42
  • Do you mind adding to your question more info about the problem you are getting now that the `nokogiri ` issue was resolved? I am not to clear about what would you be executing and what error(s) is being displayed... – The Fabio Sep 13 '15 at 06:37
0

I solved it using this command:

sudo apt-get install libgmp-dev

I found it at official nokogiri site: https://nokogiri.org/tutorials/installing_nokogiri.html#linux-usrbinld-cannot-find-lgmp

Touqeer
  • 583
  • 1
  • 4
  • 19