Rails 3, ruby-debug gem and build error on bundle install under freebsd

Since some time it seems to be somewhat impossible to install the ruby-debug gem into your rails app. The error message will most likely look similar to this one:

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug-base19-0.11.26.gem:
    ERROR: Failed to build gem native extension.
    /usr/local/bin/ruby19 extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

A workaround is described on stackoverflow. On my freebsd box I had to adapt the build command for the second gem just as follows:

% sudo gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/usr/ports/lang/ruby19/work/ruby-1.9.3-p194

If the source is missing just run make in the ruby19 port directory.

Jens Grassel Written by:

Solving problems and burning chrome for fun and profit.