2011-10-05 102 views
2

我有幾乎與下面的鏈接中討論的一個同樣的問題:的Mac OS 10.6服務器無法安裝mysql寶石

Error installing Mysql2 gem- 10.6 Server

我也跟着解決方案描述,但我得到這個:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config 
Building native extensions. This could take a while... 
ERROR: Error installing mysql2: 
    ERROR: Failed to build gem native extension. 

     /Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/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=/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby 
    --with-mysql-config 


Gem files will remain installed in /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7 for inspection. 
Results logged to /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/ext/mysql2/gem_make.out 

另外我也試圖指定的所有MySQL的路徑:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- 
--with-mysql-dir=/usr/local/mysql 
--with-mysql-lib=/usr/local/mysql/lib 
--with-mysql-include=/usr/local/mysql/include 
--with-mysql-config=/usr/local/mysql/bin/mysql_config 

仍然會出錯

$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config 
Building native extensions. This could take a while... 
ERROR: Error installing mysql2: 
    ERROR: Failed to build gem native extension. 

     /Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/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=/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby 
    --with-mysql-config 


Gem files will remain installed in /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7 for inspection. 
Results logged to /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/ext/mysql2/gem_make.out 

任何幫助apreciated。

+0

你有沒有安裝xcode?所以它可以構建本地擴展。 –

回答

0

你有連接到路徑中實際安裝的mysql頭文件嗎?你是否安裝了包含頭文件的mysql包?

/usr/local/mysql 

我已經安裝了MySQL的使用端口而且我已經在/ opt

$ find /opt -name mysql.h 
/opt/local/include/mysql5/mysql/mysql.h 

你可以嘗試

$ find /usr/local -name mysql.h 
+0

一切安裝在/ usr/local/mysql/...中,路徑是正確的。 –

+0

通常這個錯誤來自libmysqlclient沒有被安裝,但是如果你已經證實在那個位置實際上存在一個mysql.h,我很難過。 – sunkencity

0

我回溯到MySQL的59年5月1日版本,而不是5.5,它工作得很好。

看來這個寶石仍然與MySQL 5.5.xx不兼容