gem安装mysql失败[英] gem install mysql fail

本文是小编为大家收集整理的关于gem安装mysql失败的处理方法,想解了gem安装mysql失败的问题怎么解决?gem安装mysql失败问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我已经按照 http://gerialit.com/blog/2011/01/installing-mysql-with-rails-on-mac-os-os-os-os-xnow-leopard/,包括Ruby的安装通过Macport.

每当我执行 gem安装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

如何解决此问题?我已经使用软件包文件(.pkg)安装了32位mysql,而且我对Ruby非常新...

更新4/26/11 5:11 PM EST 安装了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

因此,我尝试了 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.

真的要感谢那些发表评论的人...并非常感谢是否可以提供更多帮助.....试图使DARN MYSQL安装2天...

推荐答案

通过卸载32位mysql的系统在我的系统上解决了问题..并安装了5.1.56 64位.

希望这对与我遇到相同问题的其他人有帮助.

其他推荐答案

当前未安装程序" mysql_config"程序. 您可以通过输入来安装它:

$ sudo apt-get install libmysqlclient-dev
$ bundle install

bundle show [mysql2] # To find the location.

其他推荐答案

尝试以下方法:

gem install mysql -- --with-mysql-config=/usr/local/mysql-5.1.56-osx10.6-x86/bin/mysql_config

(注意额外的破折号)

如果那不起作用,我强烈建议您使用上面提到的MySQL的自制安装.您可以在此处阅读有关汤 - 纽约人安装的信息:在Mac OS上卸载Ruby on Mac OS X 10.6

本文地址:https://www.itbaoku.cn/post/786593.html