I am attempting to install the CarrierWave gem for my Ruby on Rails application. When I go to the command prompt and type sudo gem install carrierwave I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing carrierwave:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:13:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/atomic-1.1.13 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/atomic-1.1.13/ext/gem_make.out
What on earth does this mean and how do I fix it?
Thanks, any help appreciated.
Lots of advice here: `require': no such file to load -- mkmf (LoadError)
It general, it sounds like you probably need to install some build tools.
Related
Using rbenv, runnng bundle install, and getting an error installing Json 1.8.1.
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Tried installing ruby-dev via apt (not sure that will help anyway, as ruby was installed via rbenv)
stuff that may help?
$ which gem
/home/ubuntu/.rbenv/shims/gem
$ which ruby
/home/ubuntu/.rbenv/shims/ruby
$ locate mkmf
/home/ubuntu/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/mkmf.rb
/home/ubuntu/.rbenv/versions/1.9.3-p484/share/ri/1.9.1/system/Object/mkmf-i.ri
/usr/local/rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/mkmf.log
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb
Based on your locate command, you have mkmf in rvm and in ubuntu's home diretory, but not on the system, and you're explicitly using the system's ruby (and not rbenv or rvm) to run the extconf.rb. Either run a ruby from one of the environments you have mkmf in, or install the ruby-dev package on the system.
This question already has answers here:
Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
(17 answers)
Closed 9 years ago.
Hey I'm trying to install rails on a new ubuntu machine. I have ruby and rvm installed but I'm getting a "failed to build gem native extension" error. What does this mean?
$ sudo gem install rails -v 3.2.9
(without the sudo says I don't have permissions)
Then it outputs a lot of 'fetching' commands and ultimately this error:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
When I type
$rails server
It says rails is not currently installed
Possible duplicate of:
Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
Depending on your ruby version, run:
sudo apt-get install ruby1.9.1-dev
If you are using RVM, you shouldn't ever be using 'sudo'. Using sudo calls libs and such out of the rvm path. Try just a flat:
gem install rails -v3.2.9
and see if that helps.
I'm trying to install rails on ubuntu 12.04 but I'm having some issues
I tried
sudo gem install rails --pre
and got
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
extconf.rb:13:in `require': cannot load such file -- mkmf (LoadError)
from extconf.rb:13:in `<main>'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/atomic-1.1.10 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/atomic-1.1.10/ext/gem_make.out
This is because when you installed Ruby you did not install the build tools as well.
I wrote a blog post about installing Ruby + Rails on Ubuntu that has helped out a lot of people, and will probably help you too.
Good day.
I'm trying to set up project that's beings worked on by other people.
when i run bundle install it crashes with an error
Installing bcrypt-ruby (3.0.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:36:in `<main>'
Gem files will remain installed in /home/halfros/.bundler/tmp/9279/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /home/halfros/.bundler/tmp/9279/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.
sudo gem install bcrypt-ruby -v '3.0.1'
$ sudo gem install bcrypt-ruby -v '3.0.1'
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:36:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
Tried ths - no changes.
http://rorguide.blogspot.com/2011/02/bundle-install-on-linux-giving-error.html
It looks like the ruby development library isn't installed.
It also looks like you're using global ruby/gems installation, so your easiest fix is to install the ruby1.9-dev package (or something similar), and try again.
Alternatively, you could use rvm and this problem will fix itself: https://rvm.io/
Using Ubuntu, when I run "bundle install" to set up my Rails environment, it throws an error during the JSON gem installation:
Installing json (1.7.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /home/danny/.bundler/tmp/2040/gems/json-1.7.3 for inspection.
Results logged to /home/danny/.bundler/tmp/2040/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
When I try installing only the JSON 1.7.3 gem it also gives me an error:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.7.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
I've installed RVM and am running Ruby 1.9.3; Why can't it install the JSON gem?
Installing the ruby1.9.1-dev package should fix this for you:
sudo apt-get install ruby1.9.1-dev