Skip to content

Instantly share code, notes, and snippets.

@hubb
Last active December 17, 2015 00:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hubb/5520334 to your computer and use it in GitHub Desktop.
Save hubb/5520334 to your computer and use it in GitHub Desktop.
Tweak mysql_config to properly install mysql2 gem with 10.8 and MySQL installed from dmg (only found solutions for Homebrew)
$ sudo gem install --no-rdoc --no-ri mysql2 --version 0.2.11 -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/hubb/.rbenv/versions/1.9.3-p0/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql-5.6.11-osx10.7-x86_64 --with-mysql-config=/usr/local/mysql-5.6.11-osx10.7-x86_64/bin/mysql_config --with-opt-include=/usr/local/mysql-5.6.11-osx10.7-x86_64/include
checking for rb_thread_blocking_region()... 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
--without-opt-dir
--with-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/hubb/.rbenv/versions/1.9.3-p0/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/hubb/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mysql2-0.2.11 for inspection.
Results logged to /Users/hubb/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mysql2-0.2.11/ext/mysql2/gem_make.out
$ sudo gem install --no-rdoc --no-ri mysql2 --version 0.2.11 -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql2-0.2.11
1 gem installed
diff --git a/mysql_config b/mysql_config
index fa5cf65..853c117 100644
--- a/mysql_config
+++ b/mysql_config
@@ -116,8 +116,8 @@ libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r "
embedded_libs=" $ldflags -L$pkglibdir -lmysqld "
embedded_libs="$embedded_libs "
-cflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
-cxxflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
+cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
+cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
include="-I$pkgincludedir"
# Remove some options that a client doesn't have to care about
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment