本文介绍了Rails,MySQL和Snow Leopard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在WWDC上获得的光盘升级到了雪豹.

I upgraded to Snow Leopard using the disc we got at WWDC.

现在尝试运行我的一些Rails应用程序时会抱怨sql

Trying to run some of my rails apps now complains about sql

    (in /Users/coneybeare/Projects/Ambiance/ambiance-server)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
Importing all sounds in /Users/coneybeare/Projects/Ambiance/ambiance-sounds/Import 32/Compressed/

 -- AdirondackPeepers.caf
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
dlopen(/opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib
  Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
  Reason: image not found - /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

(See full trace by running task with --trace)

我可能发誓我以前曾经解决过这个问题.问题是

I could have sworn I fixed this once before. The problem is that

sudo gem install mysql

不起作用,并显示错误消息:

does not work and gives the error:

 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 install mysql
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


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

有人有mysql可以在雪豹上使用Rails吗?如果是这样,您的设置是什么,更好的是,我该怎么做才能重现它?

Has anybody gotten mysql to work with rails on snow leopard yet? If so, what is your setup and better yet, what can I do to reproduce it?

推荐答案

我也经历了同样的痛苦……这对我有用:

I just went through the same pain... here's what worked for me:

  1. 从mysql.com下载/安装64位MySQL 5.1.37
  2. 运行以下命令:


    sudo gem update --system

    sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

我还卸载了从10.5天开始浮动的所有mysql gem,如果上述方法对您不起作用,则可以这样做:)

I also uninstalled all mysql gems that were floating around from my 10.5 days, that may do it if the above doesn't work for you :)

这篇关于Rails,MySQL和Snow Leopard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 16:03