FIXED: extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)
While reading Linux Journal Issue 181 today, I stumbled upon a section explaining about running Ruby on Rails on Apache using an Apache module called Phusion Passenger, also known as mod_rails.
To install Passenger, I followed the instruction provided in the magazine:
sudo gem install passenger
Unxpectedly, I got the following error:
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
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:8
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
What’s happening? What did I do wrong?
According to a blog post by Al Hoang, a Ruby dev package needed to be installed. Well, I wouldn’t have a clue about this!
So, to FIX this, I need to install ruby1.8-dev:
$ sudo apt-get install ruby1.8-dev
...
Now, I’m ready to install Passenger gem:
$ sudo gem install passenger
Building native extensions. This could take a while...
Successfully installed passenger-2.2.4
1 gem installed
Installing ri documentation for passenger-2.2.4...
Installing RDoc documentation for passenger-2.2.4...
Debian JSON for Ruby
I tried to install JSON for Ruby via RubyGem,
# gem install json
and I got the following error message:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb install json
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.1.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.1.6/ext/json/ext/generator/gem_make.out
However, I found out in Debian, we can just install this library libjson-ruby:
$ sudo apt-get install libjson-ruby
Now, try to verify if it works:
$ irb
irb(main):001:0> require 'json'
=> true
irb(main):002:0>



