Thursday, February 10, 2011

Bundle install on linux giving ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

Ruby version - 1.8.7, Rails version - 3.0.3
While running command bundle install on linux, getting following errors:

Installing bcrypt-ruby (2.1.2) with native extensions /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

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


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-2.1.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-2.1.2/ext/mri/gem_make.out
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:446:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:198:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19


Any suggestion on this?

4 comments:

  1. Searched many blogs, forums, same error faced by them but still no solution. :(

    ReplyDelete
  2. After lots of search, I got this solved. I had to run following commands:
    1) To install MySQL and Ruby:

    sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.0 mysql-common mysql-server-5.0 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 libhtml-template-perl mysql-server-core-5.0

    2) To download the required packages

    sudo apt-get install libc6 libpcre3 libpcre3-dev libpcrecpp0 libssl0.9.8 libssl-dev zlib1g zlib1g-dev lsb-base

    3) To install the mysql gem

    sudo apt-get install libmysqlclient-dev
    sudo gem install mysql --no-rdoc --no-ri

    ReplyDelete
  3. For complete reference, you can refer to "http://www.hackido.com/2009/04/install-ruby-rails-on-ubuntu-904-jaunty.html"

    ReplyDelete
  4. Hi

    Iam trying to configure sqlite3 and rails, but got the same error message as you mentioned.

    Do you know the packages needed to successfully install them.

    I tried libsqlite3-dev but in vain :( :(

    ReplyDelete