2014-04-28 210 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並修復它。希望這可以幫助別人。