我试图安装通过捆扎机的mysql2
宝石,但它一直与以下错误垂死:错误通过所述捆绑安装mysql2宝石
** executing command
/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in 'rescue in block in build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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=/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
--with-mysql-config
Gem files will remain installed for inspection.
我发现通过谷歌搜索建议传递--with-mysql-config
参数大部分事情修理它。因此,基于:
$ which mysql_config
/usr/bin/mysql_config
我增加了以下内容,所述捆绑的配置:
$ bundle config build.mysql2 --with-mysql-config='/usr/bin/mysql_config'
但是,仍然没有运气 - 同上崩溃。
由于它正在死于错误mysql.h is missing
,我检查了它,据说它在周围,只是不能被Bundler发现。
$ find/-name mysql.h
/usr/include/mysql5/mysql/mysql.h
有什么想法?
你在http://stackoverflow.com/questions/3608287/installing-mysql2-gem-for-rails-3上试过解决方案吗? – Wrikken 2010-09-20 21:01:27
否则,你可能只编辑'ext/mysql2/extconf.rb'并自己输入正确的路径到你的mysql目录(它靠近顶部)。 – Wrikken 2010-09-20 21:03:48