sobota, 2 lipca 2011

Ruby: Ubuntu natty `require': no such file to load -- mkmf (LoadError)

Recently I run into a problem of missing mkmf file, which is referenced by the mechanize module that I was trying to install.

root@krystianek:~# gem1.9.1 install mechanize
Building native extensions.  This could take a while...
ERROR:  Error installing mechanize:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
:29:in `require': no such file to load -- mkmf (LoadError)
    from :29:in `require'
    from extconf.rb:5:in `
'


However the solution to it is very easy - you just need to install the ruby1.9.1-dev (or ruby1.8.1-dev if you are using ruby 1.8) and the problem should be solved:

root@krystianek:~# apt-get install ruby1.9.1-dev
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  ruby1.9.1-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,166 kB of archives.
After this operation, 3,858 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ natty/universe ruby1.9.1-dev amd64 1.9.2.0-2 [1,166 kB]
Fetched 1,166 kB in 15s (77.5 kB/s)                                           
Selecting previously deselected package ruby1.9.1-dev.
(Reading database ... 163593 files and directories currently installed.)
Unpacking ruby1.9.1-dev (from .../ruby1.9.1-dev_1.9.2.0-2_amd64.deb) ...
Setting up ruby1.9.1-dev (1.9.2.0-2) ...
root@krystianek:~# gem1.9.1 install mechanize
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.5.0
Successfully installed net-http-persistent-1.8
Successfully installed net-http-digest_auth-1.1.1
Successfully installed webrobots-0.0.10
Successfully installed mechanize-2.0.1
5 gems installed
Installing ri documentation for nokogiri-1.5.0...
Installing ri documentation for net-http-persistent-1.8...
Installing ri documentation for net-http-digest_auth-1.1.1...
Installing ri documentation for webrobots-0.0.10...
Installing ri documentation for mechanize-2.0.1...
Installing RDoc documentation for nokogiri-1.5.0...
Installing RDoc documentation for net-http-persistent-1.8...
Installing RDoc documentation for net-http-digest_auth-1.1.1...
Installing RDoc documentation for webrobots-0.0.10...
Installing RDoc documentation for mechanize-2.0.1...
root@krystianek:~#


Additionally the mechanize gem requires the libxml2-dev and libxslt1-dev for building the native extensions.

Brak komentarzy:

Prześlij komentarz