3

i have git clone git://github.com/jalagrange/excel_test_app.git I got the below error while the bundle install, This does not happen with other my applications.

following error

Installing mysql2 (0.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for main() in -llibmysql... 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.

gemfile

    source 'http://rubygems.org'

gem 'rails', '3.1.0'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem "spreadsheet"
gem "carrierwave"
gem "mini_magick"
gem 'flash_cookie_session'
gem "pry"
gem "haml"
gem 'fog'

# To use Delayed_job
gem 'daemons'
gem 'delayed_job_active_record'

# 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


group :development, :test do
  gem "mysql2", "0.3.6"
  gem "letter_opener"
  gem "pry"
end

this question and answer not working for my problem.. gem install: Failed to build gem native extension (can't find header files)

problem solved, i have run bundle update.. thx all..

Community
  • 1
  • 1
rails_id
  • 8,120
  • 4
  • 46
  • 84

3 Answers3

4

Run the following command and install the bundle again

sudo apt-get install libmysql-ruby libmysqlclient-dev

Kalpesh
  • 5,635
  • 2
  • 23
  • 39
  • if still it doesn't work out, please see the accepted answer of this thread, it's the very similar problem you're facing.. http://stackoverflow.com/questions/5841406/cannot-install-mysql2-gem – Kalpesh Jul 25 '12 at 15:29
  • I got the below error while the install gem install mysql2 -v=0.3.6 but no error gem install mysql2 – rails_id Jul 25 '12 at 16:15
  • 1
    i was getting error Installing mysql2 (x.x.x) with native extensions .... and install with option.. I have tried "sudo apt-get install libmysql-ruby libmysqlclient-dev" and boom – vajapravin Dec 22 '12 at 05:19
0
sudo apt-get install libmysqlclient-dev

then

gem install mysql2 -v=X.X.x

where x.x.x is the version that you need
then bundle install

TLama
  • 75,147
  • 17
  • 214
  • 392
0

2018.11.05 => Depreciated.

After an apt search libmysqlclient-dev you will get the new package you will need to continue installing mysql2.

In my case it results default-libmysqlclient-dev

apt install default-libmysqlclient-dev

gem install mysql2 -v 0.4.6

=> then you can restart thebundle installenter code here cmd.