I'm trying to deploy my Rails 4 app on Azure VM running Ubuntu 14.04.
Here's a logfile, atomic fails to install. ruby-v gives me ruby 2.0.0p451
Any ideas how to fix that?
azureuser#my-url:~$ sudo gem install atomic
Building native extensions. This could take a while...
ERROR: Error installing atomic:
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.15 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/atomic-1.1.15/ext/gem_make.out
azureuser#my-url:~$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]
Your gems are using ruby1.9.1 and you are missing dev files.
So install that using this command
sudo apt-get install ruby1.9.1-dev
If you are not sure about your ruby version you can use this command
sudo apt-get install ruby-dev
Make sure you also have the build-essential package installed. You can check using dpkg -l | grep build-essential or simply run sudo apt-get install build-essential.
Personally I tried lots of things before realizing I was missing the above mentioned package.
Related
I am trying to install Ruby on Rails on my local machine for development purposes, but I have hit upon an error. I can't quite tell, but it seems like it might be a gem error. Though, this is my first time trying to use all three, Ruby, Gem and Rails, so I'm not sure.
Running the command "sudo gem install rails -V" these are the last few lines printed after the error is hit:
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:13:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/atomic-1.1.14 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/atomic-1.1.14/ext/gem_make.out
The version of Ruby installed is:
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
The version of gem is:
1.8.23
Install the gem as a normal user, not sudo:
gem install rails
Or install the ruby dev package. There are a lot of similar answers in SO:
Failed to build gem native extension — Rails install
Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
Failed to build gem native extension (mkmf (LoadError)) - Ubuntu 12.04
From the atomic gem README.
As of 1.1.0, JDK8 is required to build the atomic gem, since it attempts to use the new atomic
Please install Java, then re-run the gem install process.
What Linux do you have?
On Mint, i did:
sudo apt-get install git
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable --ruby
sudo apt-get install git-core
source ~/.rvm/scripts/rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm autolibs enable
rvm reload
rvm requirements
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
rvm install ruby-2.0
curl -L https://get.rvm.io | bash -s stable --rails
and it works fine. This will (currently) install Ruby 2.0 and rails 4.0 however.
RoR is nice, but sometimes makes me want to bang my head against the wall (and it's probably my fault anyway). I'm simply trying to install the Thin web-client gem, and when I run sudo gem install thin, I get the following error (it requires the installation of the eventmachine gem first):
sudo gem install thin
Fetching: eventmachine-1.0.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing thin:
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:2:in `<main>'
I've searched for the "cannot load such file -- mkmf" error, but most issues seem to be surrounding the fact that it was available in 1.8-dev but not 1.8, but as I'm running 1.9.3 I figured I had mkmf - which I verified with locate mkmf:
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb
The directory that mkmf is located in is obviously not under the /usr/lib/ruby/... directory - I'm not sure if this is my problem or not, but it maybe enough to jumpstart one of you experts out there as to what's going on and what the solution could be.
Also, I've used RVM to install ruby 1.9.3 rather than just a gem install...
Thanks in advance!
if you're 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 thin
and see if that helps.
~Kevin
I had a similar error to this outside of rvm, I found that i needed to install ruby-devel
I have same problem in Ubuntu 12.04 . Solved by:
sudo apt-get install build-essential
sudo apt-get install curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev
Try below command it will helps to resolve the problem
sudo gem install thin -- --with-cflags=\"-O2 -pipe -march=native -w\"
This did it for me:
sudo apt-get install ruby-dev
Cheers
I have this problem while installing Rails on Ubuntu 11:
root#salah:/home/salah/rubygems-1.8.15# sudo gem install mysql
Fetching: mysql-2.8.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:10:in `<main>'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
mkmf is part of the ruby-dev package if I'm not mistaken. Try:
sudo aptitude install ruby1.9.1-dev
Of course you may be better off installing ruby through RVM :)
For ubuntu 13.04, this is what worked for me:
sudo apt-get install ruby-dev
try
rvm all do gem install nokogiri
I'm trying to get Rails to work with PostgreSQL. Apparently one thing I need to do along the way is sudo gem install pg. When I do that, I get this:
jason#buster:~/projects$ sudo gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:2:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:2
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.10.0 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.10.0/ext/gem_make.out
I've Googled and tried a few things based on what I've found but nothing seems to help. Any advice? I'm on Ubuntu.
You need to install your distro ruby-dev (or devel) package otherwise you won~t be able to build any ruby C extensions.
I'm not on ubuntu, but you package-manager command might be somewhat like this:
$ sudo apt-get install ruby-dev build-essential
On Ubuntu:
$ sudo apt-get install postgresql-client libpq5 libpq-dev
$ sudo gem install pg
I'm setting up mod_rails on a Debian server but somehow something got screwed up (it wasn't me :P ).
gem install passenger
Building native extensions. This could take a while...
ERROR: Error installing passenger:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
gem is installed:
gem -v
1.3.5
ruby also fine:
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
Are you sure you have make, gcc et al?
$ sudo apt-get install build-essential
Does "which make" point to anything?
apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev
This should be everything you need to get passenger to build