gpt4 book ai didi

mysql2 gem 安装错误

转载 作者:行者123 更新时间:2023-11-29 14:06:52 26 4
gpt4 key购买 nike

在 bundle 安装中安装 mysql2 gem 失败后,我尝试安装它。当我运行时

$ sudo 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/jcollyer/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config

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/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/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]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:24: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:24:21: note: instantiated from:

define SIZEOF_LONG 8

                ^ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from

/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/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]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:24: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:28:22: note: instantiated from:

define SIZEOF_VOIDP 8

                 ^ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from

/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:1382: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/intern.h:34: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/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]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from client.c:1: In file included from ./mysql2_ext.h:8: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32: In file included from /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:24: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:28:22: note: instantiated from:

define SIZEOF_VOIDP 8

                 ^ 3 errors generated. make: *** [client.o] Error 1

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

$ ruby

/Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/bin/ruby

$其中mysql

/usr/local/bin/mysql

我错过了什么?

最佳答案

如果您计划在应用程序中使用 mysql2 gem,那么您需要在执行此操作之前安装 libmysqlclient-dev 软件包。欲了解更多详情:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

关于mysql2 gem 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14206997/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com