面对错误安装mysql2 gem

时间:2011-11-01 14:04:16

标签: ruby-on-rails-3 ruby-on-rails-3.1 gem ubuntu-11.04 mysql2

Rails要求我成功使用gem install mysql2并尝试我得到以下错误。那么这个错误主要是什么问题?错误详情如下:     由于某些原因,可能无法创建Makefile     必要的库和/或标题。检查mkmf.log文件以获取更多信息     细节。您可能需要配置选项。

Provided configuration options:
--with-opt-dir
--without-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=/usr/local/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib


    Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7 for  inspection.
   Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7/ext/mysql2/gem_make.out

的结果出现此错误
       sudo gem install mysql2

安装mysql有什么问题吗?请告诉你对此的了解,我非常感谢你花时间阅读我的问题。

感谢

3 个答案:

答案 0 :(得分:2)

如果你还没有安装mysql,请尝试添加以下完整包:

sudo apt-get install mysql-server mysql-server-5.1 libmysql-ruby libmysqlclient-dev mysql-client-5.1 mysql-common

另请查看此heroku db:pull cant connect to my DB in ubuntu

答案 1 :(得分:2)

这应该可以解决您的问题

sudo apt-get install libmysqld-dev libmysqlclient-dev mysql-client

gem install mysql2

答案 2 :(得分:0)

我第一次安装Rails尤其是mysql时出现了很多问题...尝试阅读这篇文章: Error installing mysql2: Failed to build gem native extension