如何在 Mac OS X 10.6.6 上安装 mysql 和 ruby 以及 mysql/ruby
如何在 Mac OS X 10.6.6 上安装 mysql 和 ruby 以及 mysql/ruby?我收到此错误:
checking for mysql_query() in -lmysqlclient... no
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib,
file was built for unsupported file format which is not the
architecture being linked (i386)
How can I install mysql and ruby and mysql/ruby on Mac OS X 10.6.6? I'm getting this error:
checking for mysql_query() in -lmysqlclient... no
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib,
file was built for unsupported file format which is not the
architecture being linked (i386)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
前往 http://macruby.org/downloads.html 并下载并安装 http://macruby.org/files/MacRuby%200.8.zip。
转至 http://mysql.com/downloads/mysql/ 并下载 Mac OS X 版本。 10.6(x86,64 位),DMG 存档。
转到 http://tmtm.org/en/mysql/ruby/ 并按照步骤操作下载,然后:
ruby extconf.rb --with-mysql-config
“-arch i386”
make
make install
export rvm_archflags="-arch x86_64"
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
ruby test.rb
ruby ./test.rb -- [主机名[用户[密码]] dbname [port [socket [flag]]]]]]]
注意:
如果测试时出现“
libmysqlclient not found
”错误,需要指定库所在目录位于以便 make 可以找到它。例子:
Go to http://macruby.org/downloads.html and download and install http://macruby.org/files/MacRuby%200.8.zip.
Go to http://mysql.com/downloads/mysql/ and download Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive.
Go to http://tmtm.org/en/mysql/ruby/ and follow steps to download, then:
ruby extconf.rb --with-mysql-config
"-arch i386"
make
make install
export rvm_archflags="-arch x86_64"
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
ruby test.rb
ruby ./test.rb -- [hostname [user [passwd [dbname [port [socket [flag]]]]]]]
Note:
If you get error like '
libmysqlclient not found
' when testing, you need to specify the directory in which the library is located so that make can find it.Example:
Dan Benjamin 的 Hivelogic 对此非常有用:http://hivelogic.com/articles/compiling -mysql-on-snow-leopard 和 http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard。虽然 Snow Leopard 已经有了 Ruby 1.8.7。
Dan Benjamin's Hivelogic is great for this: http://hivelogic.com/articles/compiling-mysql-on-snow-leopard and http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard. Although Snow Leopard already has Ruby 1.8.7.