首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySQL2 Ruby gem不会安装10.6

MySQL2 Ruby gem不会安装10.6
EN

Stack Overflow用户
提问于 2011-03-08 16:07:53
回答 2查看 6.5K关注 0票数 7

我知道这已经被问了好几次了,但是我搜索了,我尝试了很多不同的东西,但都没有效果。

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-03-23 19:40:03

我也有同样的问题。我完全卸载了MySQL,重新安装了64位版本,并使用指向MySQL安装的选项安装了mysql2 gem,从而解决了这些问题。

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

1.卸载MySQL

代码语言:javascript
复制
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位版

gem 3.安装 mysql2

代码语言:javascript
复制
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 :)

票数 9
EN

Stack Overflow用户

发布于 2011-07-13 00:43:03

This blog post解决了我遇到的一个类似的问题。

为了构建mysql2 gem,您需要安装libmysqlclient-dev

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5229907

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档