How to solve the «Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.» problem?

июля 4, 2012  |  Published in Ruby, Ruby Gems, Расширения

So, how to solve the «Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.» problem?

You can solve this problem by adding ‘—with-ruby-include‘ option to ‘gem install‘ command. Firstly, check your current Ruby interpreter version with this:

$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

Or this:

$ rvm current
ruby-1.9.3-p194@r326

Secondly, you should install ruby gem that you want to be installed with this:

$ gem install <ruby gem name> — —with-ruby-include=$rvm_path/src/<ruby version>

For me Ruby version is ruby-1.9.3-p194. Real example:

$ gem install ruby-debug19 — —with-ruby-include=$rvm_path/src/ruby-1.9.3-p194/

Thats all! Happy developing with Ruby, friends!

Tags: , ,