mysql - 使用 Rails 3 (Lion 10.7) 安装 MySQL Gem

标签 mysql ruby-on-rails-3 rubygems

当我尝试在 OSX 10.7 Lion 上使用 Rails 3 安装 MySQL gem 时出现此错误。 我的 Ruby 版本是 ruby​​ 1.9.2p290。我已经安装了 MySQL 并且它运行良好。

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/Users/garethbarker/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-dir=/usr/bin --with-mysql-lib=/usr/lib64/mysql

checking for mysql_ssl_set()... no
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
*** 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=/Users/garethbarker/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-mysql-config
--without-mysql-config


Gem files will remain installed in /Users/garethbarker/.rvm/gems/ruby-1.9.2-p290/gems/mysql-2.8.1 for inspection.
Results logged to /Users/garethbarker/.rvm/gems/ruby-1.9.2-p290/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

最佳答案

我记得在我的 Lion OS 上遇到过类似的问题。试试这个。我发现它在我的 ~/.bash_profile 中。添加到你的 ~/.bash_profile:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib

关于mysql - 使用 Rails 3 (Lion 10.7) 安装 MySQL Gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8963624/

相关文章:

OS X Snow Leopard 上的 MySQL Ruby Gem

mysql 列结果的一部分不同

mysql - 从另一列更新具有最高值的 SQL 列

ruby-on-rails - 异常通知 gem "ERROR: Failed to generate exception summary"

ruby-on-rails - Ruby on Rails - 切换生产应用程序以使用 RVM,或升级 Ruby?

ruby - 如何将 gem 复制到另一台服务器?

ruby-on-rails - 判断 gem 是否被调用为 Rake 任务

mysql - NPM mysql模块中的connect方法是否阻塞?

mysql - Active Record Rails 查询

ruby-on-rails - 为什么我的部分无法正确接收参数?