Rails,MySQL和Snow Leopard
我使用我们在WWDC获得的光盘升级到Snow Leopard。
试图运行我的一些rails应用程序现在抱怨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)
我可以发誓我之前解决了这个问题。 问题在于
sudo gem install mysql
不起作用,并给出错误:
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与雪豹铁轨工作呢? 如果是这样,你的设置是什么,更好的是,我能做些什么来重现它?
我刚刚经历了同样的痛苦......这是对我有用的东西:
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 gems,如果上述不适合你,那么可能会这样做:)
将64位重建为64位或安装64位版本非常重要,但您还需要确保将MySQL gem的本机部分构建为64位(如果您使用的是原始英特尔酷睿双核处理器之一,则这不适用) )。
这是魔术命令:
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
每当您在Snow Leopard上使用本地组件进行gem安装时,您应该如上所示设置ARCHFLAGS。
如果你使用的是Bundler,你可以使用“bundle config”为mysql设置正确的构建参数,如下所示:
bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
链接地址: http://www.djcxy.com/p/5683.html