本文介绍了MySQL2 Ruby gem将不会安装10.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经被问过几次了,但是我进行了搜索,尝试了许多不同的方法,但是没有任何效果.

I know this has been asked several times, but I searched and I tried many different things and nothing worked.

ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

        /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
gcc -I. -I/Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch i386 -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe -Wall -funroll-loops  -o client.o -c client.c
In file included from /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
                 from ./mysql2_ext.h:4,
                 from client.c:1:
/Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:108: error: size of array ‘ruby_check_sizeof_long’ is negative
/Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:112: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/intern.h:29,
                 from /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:1327,
                 from /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
                 from ./mysql2_ext.h:4,
                 from client.c:1:
/Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/st.h:69: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative
make: *** [client.o] Error 1


Gem files will remain installed in /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6 for inspection.
Results logged to /Users/kishinmanglani/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/ext/mysql2/gem_make.out

推荐答案

我遇到了完全相同的问题.我通过完全卸载MySQL,重新安装64位版本并安装mysql2 gem和指向MySQL安装的选项来解决它们.

I had the exact same problems. I resolved them by uninstalling MySQL completely, reinstalling the 64 bit version and installing the mysql2 gem with options pointing to the MySQL install.

我遵循了在 petermac.com 中找到的一些说明:

I followed some instructions I found at petermac.com:

1.卸载MySQL :

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*

edit /etc/hostconfig and remove the line MYSQLCOM=-YES-

sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

2.安装MySQL 64位版本

3.安装mysql2 gem

3. Install mysql2 gem

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

那至少应该安装了gem:)

That should at least get the gem installed :)

这篇关于MySQL2 Ruby gem将不会安装10.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:53