安装mysql2 gem时出错

时间:2011-06-09 10:58:04

标签: ruby ruby-on-rails-3 ruby-1.9.2 mysql2

尝试在ruby 1.9.2上安装mysql2 gem,我收到此错误:

Installing mysql2 (0.3.2) with native extensions /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /Users/dombesz/.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/dombesz/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.7.0 -I/Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/dombesz/.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  -g -Os -arch i386 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -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/dombesz/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
                 from ./mysql2_ext.h:8,
                 from client.c:1:
/Users/dombesz/.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/dombesz/.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/dombesz/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/intern.h:29,
                 from /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:1327,
                 from /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
                 from ./mysql2_ext.h:8,
                 from client.c:1:
/Users/dombesz/.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
client.c: In function ‘rb_mysql_client_escape’:
client.c:174: warning: unused parameter ‘klass’
make: *** [client.o] Error 1


Gem files will remain installed in /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2 for inspection.
Results logged to /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/ext/mysql2/gem_make.out
    from /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
    from /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
    from /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
    from /Users/dombesz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `block in install'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `block (2 levels) in run'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `block in run'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in each'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
    from /Users/dombesz/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:
in `<main>'

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

通过重新安装mysql解决。

有关详细信息,请参阅此帖子:MySQL2 Ruby gem will not Install 10.6