本文介绍了无法安装mysql2 gem OS X Mountain Lion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是RoR的新手,我正在尝试安装Mysql2 -v'0.3.11'。
我有OS X Mountain Lion,rails 3.2.6,ruby 1.9.3。



下面是我得到的错误。

  $ gem install mysql2 -v'0.3.11'
建筑物本地扩展。这可能需要一段时间...
错误:安装mysql2时出错:
错误:无法构建gem本机扩展。

/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
检查rb_thread_blocking_region()...是
检查对于rb_wait_for_single_fd()...是
检查mysql.h ...是
检查errmsg.h ...是
检查mysqld_error.h ...是
创建Makefile
$ b $ make make
编译client.c
在client.c中包含的文件中:1:
从./mysql2_ext.h:8包含的文件中:
包含在/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby.h:32:
/ Users / curiosity /中的文件。 rvm / rubies / ruby​​-1.9.3-p125 / include / ruby​​-1.9.1 / ruby​​ / ruby​​.h:105:37:error:'ruby_check_sizeof_long'声明为一个负数大小的数组$ b $ typedef char ruby​​_check_sizeof_long [SIZEOF_LONG == sizeof(long)? 1:-1];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~。 rvm / rubies / ruby​​-1.9.3-p125 / include / ruby​​-1.9.1 / x86_64-darwin12.0.0 / ruby​​ / config.h:24:21:注意:从宏'SIZEOF_LONG'扩展
#define SIZEOF_LONG 8
^
从client.c包含的文件中:1:
从./mysql2_ext.h:8包含的文件中:
在/ Users /好奇/ .rvm / rubies / ruby​​-1.9.3-p125 / include / ruby​​-1.9.1 / ruby​​.h:32:
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include /ruby-1.9.1/ruby/ruby.h:109:38:error:'ruby_check_sizeof_voidp'声明为一个负数大小的数组
typedef char ruby​​_check_sizeof_voidp [SIZEOF_VOIDP == sizeof(void *)? 1:-1];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~好奇/好奇心/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin12.0.0/ruby/config.h:28:22:注意:从宏'SIZEOF_VOIDP'
扩展#define SIZEOF_VOIDP 8
^
从client.c包含的文件中:1:
从./mysql2_ext.h:8中包含的文件中:
在/ Users /好奇心/ .rvm / rubies / ruby​​-1.9.3-p125 / include / ruby​​-1.9.1 / ruby​​.h:32:
从/Users/curiosity/.rvm/rubies/ruby-1.9包含的文件.3-p125 / include / ruby​​-1.9.1 / ruby​​ / ruby​​.h:1377:
从/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby -1.9.1 / ruby​​ / intern.h:34:
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/st.h:67 :45:error:'st_check_for_sizeof_st_index_t'被声明为一个大小为负数的数组
typedef char st_check_for_sizeof_st_index_t [SIZEOF_VOIDP ==(int)sizeof(st_index_t)? 1:-1];
^〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜 ~~
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin12.0.0/ruby/config.h:28:22:note:从宏'SIZEOF_VOIDP'扩展
#define SIZEOF_VOIDP 8
^
产生3个错误。
make:*** [client.o]错误1


Gem文件将保留安装在/Users/curiosity/.rvm/gems/ruby-1.9.3- p125 / gems / mysql2-0.3.11进行检查。
结果记录到/Users/curiosity/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/ext/mysql2/gem_make.out


感谢您的帮助。

解决方案

您使用RVM而不是10.8版本的Ruby。好。现在,停止使用10.8附带的MySQL。



安装并更新 。现在运行

  brew install mysql 

使用项目中的 / Gemfile 来安装 mysql2 gem。添加

  gemmysql2

添加到 / Gemfile 中。然后通过运行来更新您的应用程序Bundle

  bundle install 

让包管理器(Homebrew和Bundler)为您工作。

解决您遇到的问题。


I'm new with RoR and I'm trying to install Mysql2 -v '0.3.11'.I have OS X Mountain Lion, rails 3.2.6 ,ruby 1.9.3.

Below is the error I get. I looked everywhere and didn't find anything.

$gem install mysql2 -v '0.3.11'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.

    /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
compiling client.c
In file included from client.c:1:
In file included from ./mysql2_ext.h:8:
In file included from /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby.h:32:
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/ruby.h:105:37:     error: 'ruby_check_sizeof_long' declared as an array with a negative size
typedef char ruby_check_sizeof_long[SIZEOF_LONG == sizeof(long) ? 1 : -1];
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin12.0.0/ruby/config.h:24:21: note: expanded from macro 'SIZEOF_LONG'
#define SIZEOF_LONG 8
                ^
In file included from client.c:1:
In file included from ./mysql2_ext.h:8:
In file included from /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby.h:32:
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/ruby.h:109:38: error: 'ruby_check_sizeof_voidp' declared as an array with a negative size
typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin12.0.0/ruby/config.h:28:22: note: expanded from macro 'SIZEOF_VOIDP'
#define SIZEOF_VOIDP 8
                 ^
In file included from client.c:1:
In file included from ./mysql2_ext.h:8:
In file included from /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby.h:32:
In file included from /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/ruby.h:1377:
In file included from /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:34:
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/st.h:67:45: error: 'st_check_for_sizeof_st_index_t' declared as an array with a negative size
typedef char st_check_for_sizeof_st_index_t[SIZEOF_VOIDP == (int)sizeof(st_index_t) ? 1 : -1];
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin12.0.0/ruby/config.h:28:22: note: expanded from macro 'SIZEOF_VOIDP'
#define SIZEOF_VOIDP 8
                 ^
3 errors generated.
make: *** [client.o] Error 1


Gem files will remain installed in /Users/curiosity/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/curiosity/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

Thanks for your help.

解决方案

You're using RVM instead of the Ruby that comes with 10.8. Good. Now, stop using the MySQL that comes with 10.8.

Install and update Homebrew. Now run

brew install mysql

Use the /Gemfile in your project to install the mysql2 gem. Add

gem "mysql2"

to your /Gemfile. Then update your application with Bundler by running

bundle install

Let the package managers (Homebrew and Bundler) work for you.

This should fix the issues you're having.

这篇关于无法安装mysql2 gem OS X Mountain Lion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:48