Kyl*_*yle 11 ruby mysql macos rubygems ruby-on-rails
我按照http://geryit.com/blog/2011/01/installing-mysql-with-rails-on-mac-os-x-snow-leopard/上的说明进行操作,包括通过macport安装ruby.
每当我执行gem install mysql时 ,我都会收到以下错误
bash-3.2# 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
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
--without-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
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?我已经使用包文件(.pkg)安装了32位mysql,而且,我对ruby非常新...
更新4/26/11美国东部时间下午5:11
安装RVM并更新ruby到1.9.2此外,我查看了评论中发布的链接.我做了locate mysql_config
,结果是
/usr/local/mysql-5.1.56-osx10.6-x86/bin/mysql_config
/usr/local/mysql-5.1.56-osx10.6-x86/man/man1/mysql_config.1
Run Code Online (Sandbox Code Playgroud)
因此,我试过
gem install mysql - -with-mysql-config=/usr/local/mysql-5.1.56-osx10.6-x86/bin/mysql_config
但它仍然无法工作......但我确实得到了新的错误信息..
/Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
from extconf.rb:50:in `<main>'
Gem files will remain installed in /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/bin/th-mysql-config=/usr/local/mysql-5.1.56-osx10.6-x86/bin/mysql_config/gems/mysql-2.8.1 for inspection.
Run Code Online (Sandbox Code Playgroud)
非常希望感谢那些评论过的人......并且真的很感激如果能给予更多的帮助.....一直试图让安装了2天的darn mysql ...
Vic*_*cky 18
目前尚未安装程序'mysql_config'.您可以输入以下命令安装它:
$ sudo apt-get install libmysqlclient-dev
$ bundle install
bundle show [mysql2] # To find the location.
Run Code Online (Sandbox Code Playgroud)
Mik*_*mer 11
试试这个:
gem install mysql -- --with-mysql-config=/usr/local/mysql-5.1.56-osx10.6-x86/bin/mysql_config
Run Code Online (Sandbox Code Playgroud)
(注意额外的破折号)
如果这不起作用,我强烈建议使用MySQL上面提到的自制安装.你可以在这里阅读关于汤到坚果的安装:在Mac OS X 10.6上卸载Ruby on Rails
我在Cent OS中遇到了同样的问题,但是通过安装mysql-devel解决了这个问题
yum install mysql mysql-server mysql-devel
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
33246 次 |
| 最近记录: |