日期:2014-05-16  浏览次数:20507 次

rails 安装数据库mysql sqlite 包时报错 解决
rails在gem install mysql/sqlite3的时候,如果报以下错误:
1、Installing sqlite3-ruby (1.3.1) with native extensions
/usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in`build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby1.8 extconf.rb extconf.rb:3:in `require': no such file to load -- mkmf (LoadError) from extconf.rb:3

2、Installing mysql (2.8.1) with native extensions /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in`build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no




此时是由于没有安装相应的包:
具体解决办法有两个:
1、解决办法:sudo apt-get install ruby1.8-dev(sqlite 和  mysql 报以上的错都是类似的,只要安装这个包就可以了)

2、解决办法:sudo apt-get install libmysqlclient15-dev 报2的错误是由于没有安装客户端的原因

1、2问题分别进行对应1、2解决办法