2012-02-13 66 views
0

我想第一次設置rails。我已經制作了應用程序,我一直在關注很多指南。設置Ruby on Rails應用程序。安裝mysql的問題寶石

當我嘗試安裝MySQL寶石gem install mysql

Building native extensions. This could take a while... 
ERROR: Error installing mysql: 
     ERROR: Failed to build gem native extension. 

     /usr/bin/ruby extconf.rb 
checking for mysql_ssl_set()... no 
checking for rb_str_set_len()... no 
checking for rb_thread_start_timer()... no 
checking for mysql.h... no 
checking for mysql/mysql.h... 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/bin/ruby 
     --with-mysql-config 
     --without-mysql-config 

在SO和谷歌環顧四周,有人說要做到:

gem install mysql --with-mysql-config=/usr/bin/mysql_config 

,但我得到:

ERROR: While executing gem ... (OptionParser::InvalidOption) 
    invalid option: --with-mysql-config=/usr/bin/mysql_config 

關於如何讓這個工作的任何想法?

+2

你在哪個平臺上?蘋果電腦? Linux呢? – AlistairH 2012-02-13 21:52:33

+1

什麼分佈? Ubuntu的? Debian的? – iblue 2012-02-13 22:05:13

+0

當我使用yum時,CentOS版本5.7 – Khalos 2012-02-13 22:10:54

回答

1

如果你還沒有,你需要安裝MySQL的開發庫作爲根:

yum install mysql-devel 

然後在創業板安裝,你需要有另一個命令 - 之前,在命令行 - -with-mysql-config選項:

gem install mysql -- --with-mysql-config=/usr/bin/mysql_config 
+0

我得到:導入運行yum所需的Python模塊 之一時出現問題。導致此問題的錯誤是: /usr/lib64/python2.4/lib-dynload/datetime.so:無法將映射段映射到共享對象:無法分配內存 – Khalos 2012-02-13 22:38:29

+0

Yikes。我GOOGLE了錯誤信息和其他人正在得到相同的錯誤。它通常表示一個實際的內存問題。這個職位具有良好可行的解決方案: https://www.centos.org/modules/newbb/viewtopic.php?topic_id=20849 運行的ulimit -m -d無限無限無限-v允許無限制的內存。我會小心的設置,雖然...你可能要檢查,如果別的東西是吃了你的記憶。 – 2012-02-13 22:51:07

+0

在我嘗試從主持人那裏聽到迴音之前,我會等待。他們可能會有更多關於正在運行的信息。它是一個共享主機,所以可能有其他用戶使用大量內存。 – Khalos 2012-02-13 23:29:26