问题描述
我更新了用Homebrew安装的所有软件包. MySQL已从5.5.27左右升级到5.6.12:
I updated all the packages I installed with Homebrew. MySQL got upgraded to 5.6.12 (from 5.5.27 or so):
$ mysql --version
mysql Ver 14.14 Distrib 5.6.12, for osx10.8 (x86_64) using EditLine wrapper
现在mysql2 gem不再编译了:
and now the mysql2 gem doesn't compile anymore:
$ gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/pupeno/.rvm/rubies/ruby-1.9.3-p429-perf/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/pupeno/.rvm/rubies/ruby-1.9.3-p429-perf/bin/ruby
--with-mysql-config
--without-mysql-config
/usr/local/Cellar/mysql/5.6.12/include/mysql.h
中存在文件mysql.h
.有什么想法吗?
The file mysql.h
is present in /usr/local/Cellar/mysql/5.6.12/include/mysql.h
. Any ideas what's going on?
文件mysql.h
没有出现在/usr/local
中,因为符号链接似乎比应有的更深:
The file mysql.h
doesn't appear in /usr/local
because the symlink seems to go deeper than it should:
$ ls -la /usr/local/include/mysql
lrwxr-xr-x 1 pupeno admin 36 21 Jun 15:18 /usr/local/include/mysql@ -> ../Cellar/mysql/5.6.12/include/mysql
代替
/usr/local/Cellar/mysql/5.6.12/include
话虽如此,我还是手动修复了符号链接,但编译仍然失败.所以我被卡住了.
Having said that, I manually fixed the symlink and the compilation still failed. So I'm stuck.
推荐答案
我遇到了同样的问题,我设法解决了这个问题.我做了很多事情,我不确定是什么,但是使用MySQL 5.6.10似乎行得通.
I had the same problem, I managed to fix it. I did a lot of things, and I don't know for sure what it was, but going to MySQL 5.6.10 seems to have worked.
卸载MySQL 5.6.12:
Uninstall MySQL 5.6.12:
brew unlink mysql
brew uninstall mysql
转到自制目录:
cd /usr/local
转到版本5.6.10(您可以通过运行brew versions mysql
找到版本列表:
Go to version 5.6.10 (you can find a list of versions by running brew versions mysql
:
git checkout 48f7e86 Library/Formula/mysql.rb
然后再次安装mysql:
Then install mysql again:
brew install mysql
现在gem install mysql2
为我工作.
我还从源代码(brew install mysql --build-from-source
)安装了mysql,但这并不能解决问题,但可能是解决方案的一部分.
I've also installed mysql from source (brew install mysql --build-from-source
), but that didn't solve it, but might be part of the solution.
这篇关于mysql2 gem无法在带有Homebrew的OS X上使用MySQL 5.6.12进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!