2011-03-05 78 views
1

嘿家伙 我试图从github获取Railscasts source code。当我跑步时捆绑安装,我得到这个错误:当我在Rails中运行软件包安装时发生错误

installing mysql2 (0.2.6) with native extensions /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) 

     /usr/local/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lm... yes 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lz... yes 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lsocket... no 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lnsl... no 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lmygcc... no 
checking for mysql_query() in -lmysqlclient... 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 
    --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 /Users/yozloy/.bundler/tmp/61472/gems/mysql2-0.2.6 for inspection. 
Results logged to /Users/yozloy/.bundler/tmp/61472/gems/mysql2-0.2.6/ext/mysql2/gem_make.out 
    from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:507:in `block in build_extensions' 
    from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `each' 
    from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `build_extensions' 
    from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in `install' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `block in run' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `block in each' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/bin/bundle:13:in `<top (required)>' 
    from /usr/local/bin/bundle:19:in `load' 
    from /usr/local/bin/bundle:19:in `<main>' 
+0

请发布mkmf.log文件,以便我们为您提供帮助。可能你没有安装mysql库。 – thomasfedb 2011-03-05 01:55:51

回答

4
sudo apt-get install --assume-yes mysql-server-5.1 mysql-client-5.1 libmysqlclient-dev 

这应该是所有你需要的mysql2宝石。

+0

你的代码应该可以工作,但我使用的是Mac OSX,有没有其他的选择?我已经尝试过mac端口,我应该安装'ysql-server-5.1'' mysql-client-5.1'' libmysqlclient-dev'全部三个端口来完成这个工作吗? – mko 2011-03-09 15:33:31

+0

Mac上的Homebrew应该是要走的路。它可能就像“brew安装mysql”一样简单。看看这个:http://elouisyoung.blogspot.com/2010/12/fresh-mac-rails-development-setup-quick.html – mikewilliamson 2011-03-09 17:43:59

0

我假设你在OS X上,根据你的主目录是/ Users/yozloy。你有没有安装xcode developer tools?这个包是编译某些宝石所必需的。

+0

是的,我已经安装了Xcode,问题是由于安装MySQL不正确。 – mko 2011-03-09 15:35:22

1

感谢麦克..这对我的作品:)我使用Ubuntu,刚装

的apt-get安装--assume - 是mysql的服务器 - 5.1的MySQL客户端-5.1的libmysqlclient-dev的

并为我工作。

+0

谢谢,这也适用于我。 – 2011-07-11 07:10:40

相关问题