Ruby 尝鲜安装 ruby 3.0 rails 6.1.1 mysql2 安装编译出错?

ramus · 2021年02月25日 · 最后由 ken 回复于 2021年03月01日 · 205 次阅读

看了下 0.5.3 版本的 Mysql2 说是只支持 2.7.各位有遇到这样的问题么

current directory: /Users/sheting/.rvm/gems/ruby-3.0.0/gems/mysql2-0.5.3/ext/mysql2
make "DESTDIR=" clean

current directory: /Users/sheting/.rvm/gems/ruby-3.0.0/gems/mysql2-0.5.3/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from client.c:13:
./wait_for_single_fd.h:32:10: error: implicit declaration of function 'rb_thread_select' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  return rb_thread_select(fd + 1, rfds, wfds, efds, tvp);
         ^
client.c:787:14: warning: incompatible pointer types passing 'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-pointer-types]
  rb_rescue2(do_send_query, (VALUE)&args, disconnect_and_raise, self, rb_eException, (VALUE)0);
             ^~~~~~~~~~~~~
/Users/sheting/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/internal/iterator.h:51:25: note: passing argument to parameter here
VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
                        ^
client.c:795:16: warning: incompatible pointer types passing 'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-pointer-types]
    rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0);
               ^~~~~~~~
/Users/sheting/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/internal/iterator.h:51:25: note: passing argument to parameter here
VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
                        ^
2 warnings and 1 error generated.
make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/sheting/.rvm/gems/ruby-3.0.0/gems/mysql2-0.5.3 for inspection.
Results logged to /Users/sheting/.rvm/gems/ruby-3.0.0/extensions/arm64-darwin-20/3.0.0/mysql2-0.5.3/gem_make.out

我确定 ruby3 支持 mysql2 0.5.3 但看不出你这边安装出错的原因。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号