2011-10-05 73 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不兼容