Link to home
Start Free TrialLog in
Avatar of jwright9
jwright9

asked on

Ruby error when trying to install mysql2 ruby gem

I am getting the error message: installing mysql2 (0.2.7) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.  when the mysql2 gem is being built during a "bundle install".  I appear to be missing a library or a header for the compilation.  Can someone tell me how to fix this problem?


Using launchy (0.4.0)
Using linecache (0.43)
Using mongrel (1.1.5)
Installing mysql2 (0.2.7) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

C:/Ruby187/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... no
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.

Provided configuration options:
--with-opt-dir
--without-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=C:/Ruby187/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-libmysqllib
--without-libmysqllib


Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/mysql2-0.2.7 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/mysql2-0.2.7/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.2.7), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.2.7'` succeeds before bundling.
Avatar of Andrew Doades
Andrew Doades
Flag of United Kingdom of Great Britain and Northern Ireland image

You need to install the mysql development tools, this can be done on Windows during the installation of MySQL, under Linux, just install the package 'mysql-devel'
ASKER CERTIFIED SOLUTION
Avatar of jwright9
jwright9

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jwright9
jwright9

ASKER

Solution worked.