Mysql 5.6.12 and mysql2 ruby gem 0.3.12

Posted by Jason Noble on 07/16/2013 in mysql, ruby |

I recently updated my Homebrew install and installed the latest mysql (brew update && brew upgrade mysql) to 5.6.12.

However, when I tried to upgrade my mysql2 gem from 0.3.11 to 0.3.12, I was getting the following error:

*** 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/jasonn/.rvm/rubies/ruby-1.9.3-p392/bin/ruby
	--with-mysql-config


Gem files will remain installed in /Users/jasonn/.rvm/gems/ruby-1.9.3-p392@rails3.1/gems/mysql2-0.3.12 for inspection.
Results logged to /Users/jasonn/.rvm/gems/ruby-1.9.3-p392@rails3.1/gems/mysql2-0.3.12/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.12), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.12'` succeeds before bundling.

After some googling and stack overflow answers that didn’t help, I ran across #20788, which referenced 9dd1c38 as a possible fix.

It appears that mysql 5.6.12 has an issue (69645) with compiler flags that won’t work on OS X. The fix was to edit the mysql_config file (Around line 119) and remove the -W :

cflags="-I$pkgincludedir  -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
4:31
cxxflags="-I$pkgincludedir  -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!

becomes

cflags="-I$pkgincludedir  -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir  -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!

After this change I was able to install the mysql2 0.3.12 rubygem without issue.

Tags: , , ,

Copyright © 2008-2017 Jason Noble's Technical Adventures All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.2.3, from BuyNowShop.com.