If you’re a Debian or Ubuntu user you’ll find that the Ruby standard
distribution is split into lots of little packages so doing something like
apt-get install ruby
only gives you the ruby binary and a subset of the libraries for Ruby. You’ll
need to add more packages if you want to utilize more of Ruby’s standard
library. This is all in order to comply with
That is all well and good but a little frustrating when you ‘just want to
do work’.
For example, I wanted to install
(Something I really believe should be in Ruby’s standard distribution)
however ran into the following:
$ sudo gem install sys-proctable
Building native extensions. This could take a while…
extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:8
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sys-proctable-0.7.3 for inspection.
To get around this you will need to install ruby1.8-dev (or ruby1.6-dev or
whatever version of ruby you’re running) to get mkmf.rb which is listed
in the Ruby Standard Library.
I’m sure most Ruby hackers worth their salt consider this a ‘duh’ thing
but not of all of us can be shining stars in the Ruby community
How I fixed it…
$ sudo apt-get install ruby1.8-dev
..
$ sudo gem install sys-proctable
Need to update 4 gems from http://gems.rubyforge.org
….
complete
Building native extensions. This could take a while…
ruby extconf.rb install sys-proctable
checking for rb_pid_t… yes
creating Makefile
make
gcc -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_TYPE_RB_PID_T -c proctable.c
gcc -shared -L”/usr/lib” -o proctable.so proctable.o -lruby1.8 -lpthread -ldl -lcrypt -lm -lc
make install
mkdir -p /usr/lib/ruby/gems/1.8/gems/sys-proctable-0.7.3/lib/sys
/usr/bin/install -c -m 0755 proctable.so /usr/lib/ruby/gems/1.8/gems/sys-proctable-0.7.3/lib/sys
make clean
Successfully installed sys-proctable-0.7.3
Installing ri documentation for sys-proctable-0.7.3…
Installing RDoc documentation for sys-proctable-0.7.3…
{ 3 } Comments