2014-04-28 173 views
1

需要帮助获取mysql2安装。我搜遍了所有,都感到沮丧。我是个新手,并不断遇到某些障碍。我已经设法过去了,但我正在寻求帮助。我得到以下运行 创业板安装mysql2Gem mysql2安装

[root bin]# gem install mysql2 
Building native extensions. This could take a while... 
ERROR: Error installing mysql2: 
    ERROR: Failed to build gem native extension. 

/usr/bin/ruby extconf.rb 
checking for ruby/thread.h... no 
checking for rb_thread_blocking_region()... no 
checking for rb_wait_for_single_fd()... no 
checking for rb_hash_dup()... no 
checking for rb_intern3()... no 
----- 
Using mysql_config at /usr/bin/mysql_config 
----- 
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=/usr/bin/ruby 
    --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-mysql-config 
    --without-mysql-config 


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

当我运行转速-qa | grep mysql我有以下几种

[root bin]# rpm -qa | grep mysql 
mysql-server-5.1.73-3.el6_5.x86_64 
mysql-libs-5.1.73-3.el6_5.x86_64 
mysql-devel-5.1.73-3.el6_5.x86_64 
mysql-5.1.73-3.el6_5.x86_64 

大多数其他解决方案说安装mysql-devel,但我已经安装了。看我可以在/ usr/include/mysql中看到mysql.h。大多数其他人也在/ usr/bin/mysql_config中缺少mysql_config行。

有没有人有任何ides。谢谢!

编辑:添加更多的一些细节 Centos的6.5全新安装(木偶大师从木偶实验室回购,然后加入EPEL,然后theforeman安装,试图sqlite的迁移到MySQL数据库,但需要安装mysql2宝石) MySQL 5.1中

+0

因此,在查看日志mkmf.log后,我发现一行启动了mysql.h旁边的gcc。我不知道我是否安装了gcc,所以我做了一个yum gcc并尝试了另一个gem install mysql2,它工作正常!希望这可以帮助别人 – blankstar85

回答

0

好吧,我想通了,我看着位于/usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/ext/mysql2/mkmf.log的日志mkmf.log,并注意到

-------------------- 

have_header: checking for mysql.h... -------------------- yes 

"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -I/usr/include/mysql -O2 -g -pipe   -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c$ 
checked program was: 
/* begin */ 
1: #include <mysql.h> 
/* end */ 

-------------------- 

它原本说不,但是这是来自成功的日志,但我注意到的事情是gcc在行首。我不知道我是否安装了gcc,所以我做了

yum install gcc 

然后我的gem安装mysql2并修复它。希望这可以帮助别人。