rails中的mysql gem install错误

时间:2011-07-18 08:13:30

标签: mysql ruby macos installation gem

我刚刚负责新的应用程序,已经构建的应用程序,以添加新的功能等。不幸的是,它是几年前建立的(使用rails 2.1)并使用mysql(我更喜欢postgres)。我试图安装mysql gem所以我可以搞乱我的本地机器上的代码,我收到以下错误。

$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/opt/local/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
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
    --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=/opt/local/bin/ruby
    --with-mysql-config


Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

我检查了目录/ usr / local / mysql / bin / mysql_config以确保文件存在(确实存在)...我从mysql站点安装了带有dmg文件(v 5.1)的mysql。

坦率地说,我不知道如何解决这个问题。有什么建议吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

我认为dmg文件中不包含mysql头文件。安装Homebrew或Macports并运行brew install mysqlsudo port -v install mysql5-server mysql5