gem mysql2适配器未安装

cu6pst1q  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(317)

当我试图安装 mysql2 适配器gem,我得到这个错误:

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

    /Users/jwan/.rbenv/versions/2.1.2/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
-----
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling infile.c
compiling client.c
client.c:439:3: error: use of undeclared identifier 'my_bool'
  my_bool res = mysql_read_query_result(client);
  ^
client.c:441:19: error: use of undeclared identifier 'res'
  return (void *)(res == 0 ? Qtrue : Qfalse);
                  ^
client.c:762:3: error: use of undeclared identifier 'my_bool'
  my_bool boolval;
  ^
client.c:793:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:794:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:797:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
    case MYSQL_SECURE_AUTH:
         ^~~~~~~~~~~~~~~~~
         MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
  MYSQL_DEFAULT_AUTH,
  ^
client.c:798:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:799:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:830:38: error: use of undeclared identifier 'boolval'
        wrapper->reconnect_enabled = boolval;
                                     ^
client.c:1185:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
  return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
                                     ^~~~~~~~~~~~~~~~~
                                     MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
  MYSQL_DEFAULT_AUTH,
  ^
10 errors generated.
make:***[client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jwan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.21 for inspection.

这是什么意思,是怎么回事?
这条线做什么: Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib 我可以试着把它指向另一个版本的mysql吗?

hl0ma9xz

hl0ma9xz1#

因为您使用的是mysql2 gem的不可Map版本,所以您必须使gemfile中的所有gem版本与google rubygems(gem name)版本正确匹配一个好方法是查看它的运行时依赖性和发布日期发布日期可以与rails版本的发布日期进行比较其他的宝石,这取决于你什么时候是新的,这可能需要一点时间

相关问题