0

I have looked through multiple questions on stackoverflow and they all gave different solutions to the problem. I git cloned a rails project, ran bundle install, and created a new gemset in rvm using 1.9.3 ruby and figured rails 3.2.13 will also get installed with the bundle install command. In the past I solved this issue by using this guide, http://www.randomactsofsentience.com/2013/05/gem-install-mysql2-missing-mysqlh-on-os.html. I couldn't find mysql folder in user/local, the guide said I need to edit a file and get rid of somelines to resolve the mysql.h missing issue. This file no longer exist? I couldn't find it? maybe I am missing dependencies but I found linux installation ways of these dependencies? maybe I need to install mysql5.5 instead of the latest version but not sure how to specify that? which one of these will solve this for me?

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

    /Users/judyngai/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/judyngai/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
    --with-mysql-config
    --without-mysql-config


Gem files will remain installed in /Users/judyngai/.rvm/gems/ruby-1.9.3-p429@spreeversion    /gems/mysql2-0.3.11 for inspection.
Results logged to /Users/judyngai/.rvm/gems/ruby-1.9.3-p429@spreeversion/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
Jngai1297
  • 2,415
  • 5
  • 29
  • 63

1 Answers1

1

You need to set up mysql development headers (thus, .h file extension) first before bundle / gem can build your native mysql extension. Which OS are you on? So I can extend my answer...

E.g. on debian, it would be: apt-get install libmysqlclient-dev (on other systems, it might be named different, like mysql-devel). If you're on OSX, there's that very informative answer on bundle install problem: mysql.h is missing that might help you. And for windows, this might help: Missing mysql.h and trying to find mysql-devel.

Community
  • 1
  • 1
pdu
  • 10,295
  • 4
  • 58
  • 95