我的堆栈如下:
- CentOS 6.3
安装了 MySQL 5.5(遵循 http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/ 中的步骤,因为 yum 仍然有 MySQL 5.1,如果我尝试 yum 安装任何与 mysql 相关的包,它当然会中断,因为 yum 期望 5.1)
$> mysql --版本 mysql Ver 14.14 Distrib 5.5.27,适用于使用 readline 5.1 的 Linux (x86_64)
$> ruby --version ruby 1.9.3p194(2012-04-20 修订版 35410)[x86_64-linux]
$> rvm --version rvm 1.14.6(稳定版),作者:Wayne E. Seguin,Michal Papis [https://rvm.io/]
$> uname -a Linux localhost.mkf 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Aug 14 23:54:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$> nginx -v nginx版本:nginx/1.2.2
$> rails -v rails 3.2.6
当我尝试安装 mysql2 gem 时,出现以下错误:
$> gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... 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
--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/rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2- 0.3.11/ext/mysql2/gem_make.out
当我这样做
$> find / -name mysql.h
我什么都没有
Mysql 运行正常,我已经在其中创建了数据库和表,并且 sql 运行没有任何问题。
是否可以在我的堆栈中安装 mysql2 gem?如果是这样,那么知道我缺少什么吗?
更新:我试过 yum install mysql-devel
它抛出错误,因为我 安装了 mysql5.5,使用 Remi 存储库。虽然百胜期望 MySQL 5.1
请您参考如下方法:
你安装了mysql
了吗? 如果不这样做,您还需要安装 mysql 开发文件以进行 gem 的本地编译
sudo yum install mysql-devel