Updating MySQL Gem to 2.7
While updating my installed gems this evening I ran into an issue with the mysql-2.7 gem:
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.ruby extconf.rb update
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… no
checking for mysql_query() in -lmysqlclient… no
The solution was to explicitly tell gem where the local MySQL install is:
Sagarmatha:~ chris$ which mysql
/usr/local/mysql/bin/mysqlSagarmatha:~ chris$ sudo gem install mysql — –with-mysql-dir=/usr/local/mysql
Caveat: Note the double -- between mysql and --with. That’s not a typo (though it may look like a single dash in this page in some browsers).