Gem OS X Lion 下死活装不上 mysql 这个 gem

yzhrain · 2012年06月16日 · 最后由 jyfeather 回复于 2013年06月06日 · 4222 次阅读

今天由于升级 rvm,把原来的环境删除掉了,重新安装一套。 结果死活没装上 mysql 这个 gem 操作系统是 Mac OS X Lion

env ARCHFLAGS="-arch x86_64" gem install mysql -v 2.8.1 -- -with-mysql-dir=/usr/local/Cellar/mysql/5.1.49 -with-mysql-lib=/usr/local/Cellar/mysql/5.1.49/lib -with-mysql-include=/usr/local/Cellar/mysql/5.1.49/include  -with-mysql-config=/usr/local/Cellar/mysql/5.1.49/bin/mysql_config


checking for mysql_query() in -lmysqlclient... yes
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... yes
checking for mysql.h... no
checking for mysql/mysql.h... 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=/Users/rain/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --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-mysqlclientlib
    --without-mysqlclientlib

我都快给 mysql gem 跪了,每次安装都会有问题。

错误信息里提示找不到 mysql.h 文件,但是这个文件明明是有的

checking for mysql.h... no
checking for mysql/mysql.h... no

/usr/local/Cellar/mysql/5.1.49/include/mysql/mysql.h

为什么是 mysql?而不是 mysql2?

#1 楼 @lgn21st 一直使用 mysql,项目的 Rails 版本还是 2.3.12。 不知道 mysql2 在使用上与 mysql 有区别么?

rails 2.3 用 0.2.x 版本。

#3 楼 @fredwu 你指的是 mysql2 么?

后来把 mysql 干掉,重新用 brew 安装了一遍 mysql 就解决了,估计问题是由于我的 mysql 是很久之前安装的,后来我升级 brew 和 rvm 导致找不到 mysql.h 文件的问题。

我的也是这个问题,真是啃爹呀

本来不甘心卸了重装,看到你的帖子,我也决定重头来一波啦

需要 登录 后方可回复, 如果你还没有账号请 注册新账号