Installing Cucumber on Ubuntu - cannot load such file -- mkmf (LoadError) message
Archive - Originally posted on "The Horse's Mouth" - 2015-01-04 11:55:35 - Graham EllisThis week, I'm doing Ruby training using Ubuntu Linux ... and I'm running (at customer's request) in a heaviliy Behaviour Driven Development mode using Cucumber. This note is to share with an installation problem ... easily fixed once you know how.
Problem:
root@caerphilly:~# gem install cucumber
Fetching: builder-3.2.2.gem (100%)
Fetching: diff-lcs-1.2.5.gem (100%)
Fetching: multi_json-1.10.1.gem (100%)
Fetching: gherkin-2.12.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing cucumber:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/gherkin-2.12.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/gherkin-2.12.2/ext/gherkin_lexer_ar/gem_make.out
root@caerphilly:~#
Solution:
you need the development environment for Ruby - for the Ubuntu version I'm using, the extra is
apt-get install ruby1.9.1-dev
and then these two work nicely
gem install cucumber
gem install rspec
See [here] for details of our Ruby training. Public courses will overview design, testing, test driven development and behaviour driven development, and delegates are welcome to learn within such an environment. On private courses, we can take a somewhat more active approach to BDD and TDD and introduce it early on as a framework for much of the course if required.