{"id":542,"date":"2006-10-27T00:15:09","date_gmt":"2006-10-27T05:15:09","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/hoanga\/2006\/10\/27\/fixing-mkmf-load-error-ruby-in-ubuntu\/"},"modified":"2006-12-13T22:28:53","modified_gmt":"2006-12-14T03:28:53","slug":"fixing-mkmf-load-error-ruby-in-ubuntu","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/hoanga\/2006\/10\/27\/fixing-mkmf-load-error-ruby-in-ubuntu\/","title":{"rendered":"Fixing &#8216;mkmf&#8217; load error Ruby in Ubuntu"},"content":{"rendered":"<p><a name='a668'><\/a><\/p>\n<p>If you&#8217;re a Debian or Ubuntu user you&#8217;ll find that the Ruby standard<\/p>\n<p>distribution is split into lots of little packages so doing something like<\/p>\n<p><em>apt-get install ruby<\/em><\/p>\n<p>only gives you the ruby binary and a subset of the libraries for Ruby.  You&#8217;ll<\/p>\n<p>need to add more packages if you want to utilize more of Ruby&#8217;s standard<\/p>\n<p>library.  This is all in order to comply with<\/p>\n<p><a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/\">Debian packaging Guidelines<\/a>.<\/p>\n<p>That is all well and good but a little frustrating when you &#8216;just want to<\/p>\n<p>do work&#8217;.<\/p>\n<p>For example, I wanted to install <\/p>\n<p><a href=\"http:\/\/raa.ruby-lang.org\/project\/sys-proctable\/\">sys-proctable<\/a><\/p>\n<p>(Something I really believe should be in Ruby&#8217;s standard distribution)<\/p>\n<p>however ran into the following:<\/p>\n<p><\/p>\n<p><em><\/p>\n<p>$ sudo gem install sys-proctable<\/p>\n<p>Building native extensions.  This could take a while&#8230;<\/p>\n<p>extconf.rb:8:in `require&#8217;: no such file to load &#8212; mkmf (LoadError)<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;from extconf.rb:8<\/p>\n<p>ERROR:  While executing gem &#8230; (RuntimeError)<\/p>\n<p>&nbsp;&nbsp;&nbsp;ERROR: Failed to build gem native extension.<\/p>\n<p>Gem files will remain installed in \/usr\/lib\/ruby\/gems\/1.8\/gems\/sys-proctable-0.7.3 for inspection.<\/p>\n<p><\/em><\/p>\n<p>To get around this you will need to install ruby1.8-dev (or ruby1.6-dev or<\/p>\n<p>whatever version of ruby you&#8217;re running) to get mkmf.rb which is listed<\/p>\n<p>in the <a href=\"http:\/\/www.ruby-doc.org\/stdlib\/\">Ruby Standard Library<\/a>.<\/p>\n<p>I&#8217;m sure most Ruby hackers worth their salt consider this a &#8216;duh&#8217; thing<\/p>\n<p>but not of all of us can be shining stars in the Ruby community<\/p>\n<p>How I fixed it&#8230;<\/p>\n<p><em><\/p>\n<p>$ sudo apt-get install ruby1.8-dev<\/p>\n<p>..<\/p>\n<p>$ sudo gem install sys-proctable<\/p>\n<p>Need to update 4 gems from http:\/\/gems.rubyforge.org<\/p>\n<p>&#8230;.<\/p>\n<p>complete<\/p>\n<p>Building native extensions.  This could take a while&#8230;<\/p>\n<p>ruby extconf.rb install sys-proctable<\/p>\n<p>checking for rb_pid_t&#8230; yes<\/p>\n<p>creating Makefile<\/p>\n<p>make<\/p>\n<p>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<\/p>\n<p>gcc -shared  -L&#8221;\/usr\/lib&#8221; -o proctable.so proctable.o  -lruby1.8  -lpthread -ldl -lcrypt -lm   -lc<\/p>\n<p>make install<\/p>\n<p>mkdir -p \/usr\/lib\/ruby\/gems\/1.8\/gems\/sys-proctable-0.7.3\/lib\/sys<\/p>\n<p>\/usr\/bin\/install -c -m 0755 proctable.so \/usr\/lib\/ruby\/gems\/1.8\/gems\/sys-proctable-0.7.3\/lib\/sys<\/p>\n<p>make clean<\/p>\n<p>Successfully installed sys-proctable-0.7.3<\/p>\n<p>Installing ri documentation for sys-proctable-0.7.3&#8230;<\/p>\n<p>Installing RDoc documentation for sys-proctable-0.7.3&#8230;<\/p>\n<p><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re a Debian or Ubuntu user you&#8217;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&#8217;ll need to add more packages if you want to utilize more of [&hellip;]<\/p>\n","protected":false},"author":703,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1100,972,615],"tags":[],"class_list":["post-542","post","type-post","status-publish","format-standard","hentry","category-linux","category-programming","category-ruby"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/users\/703"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/comments?post=542"}],"version-history":[{"count":0,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/542\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/media?parent=542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/categories?post=542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/tags?post=542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}