Sorry I’m totally new in ruby and gems.
I installed a module via gems failed this day. The error shows:
gem install cassandra
Building native extensions. This could take a while…
ERROR: Error installing cassandra:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:21:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:21
Gem files will remain installed in
/var/lib/gems/1.8/gems/thrift-0.2.0.4 for inspection.
Results logged to /var/lib/gems/1.8/gems/thrift-0.2.0.4/ext/gem_make.out
I’m running ruby-1.8 in ubuntu 9.10.
How to fix it? thanks.
what’s the purpose of require ‘rubygems’?
I found that if I didn’t require rubygems then require cassandra will get fail.
In the version of Ruby you’re using, the rubygems module is not loaded
by default. Without rubygems loaded, the require method does not know
how to find your gems when you try to require them. Ruby 1.9 loads
rubygems by default, so it’s optional to do so there.
If you don’t want to explicitly require rubygems in your script, you can
also set an environment variable named RUBYOPT as follows to cause your
version of Ruby to load it automatically:
export RUBYOPT=-rubygems
Keep in mind that this environment variable would have to be set any
time you want to run your script with Ruby 1.8.