I run cap deploy and got the following problem,
** [out :: 122.248.240.239] Installing mysql2 (0.3.7)
** [out :: 122.248.240.239] with native extensions
** [out :: 122.248.240.239]
** [out :: 122.248.240.239] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
** [out :: 122.248.240.239]
** [out :: 122.248.240.239] /home/ubuntu/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
** [out :: 122.248.240.239]
** [out :: 122.248.240.239] Gem files will remain installed in /var/www/iperpus/shared/bundle/ruby/1.9.1/gems/mysql2-0.3.7 for inspection.
** [out :: 122.248.240.239] Results logged to /var/www/iperpus/shared/bundle/ruby/1.9.1/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
** [out :: 122.248.240.239] An error occured while installing mysql2 (0.3.7), and Bundler cannot continue.
** [out :: 122.248.240.239] Make sure that `gem install mysql2 -v '0.3.7'` succeeds before bundling.
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/installer.rb:80:in `rescue in install_gem_from_spec'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/installer.rb:61:in `install_gem_from_spec'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/installer.rb:50:in `block in run'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/installer.rb:49:in `run'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/installer.rb:8:in `install'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/cli.rb:219:in `install'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `run'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in `dispatch'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in `start'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/bin/bundle:13:in `<top (required)>'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/bin/bundle:19:in `load'
** [out :: 122.248.240.239] /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/bin/bundle:19:in `<main>'
Content of Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
gem 'execjs'
gem 'therubyracer'
gem 'devise', "1.4.7"
gem "compass", ">= 0.11.5"
gem 'haml'
gem "oa-oauth", :require => "omniauth/oauth"
gem 'mysql2'
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
gem 'sunspot'
gem 'sunspot_rails'
Inside deploy.rb, I already added:
require "bundler/capistrano"
I use RVM 1.8.4, running on Ubuntu 10.04.
All the dependencies of MySQL have been installed.
Oddly, gem install mysql2 works! But bundle install mysql2 doesn’t works
What would be the source of the problem?
Make sure you have the client development libraries for mysql installed:
sudo apt-get install libmysqlclient-dev