gpt4 book ai didi

ruby-on-rails - mysql2 Ruby Gem 无法安装 ubuntu 20.04

转载 作者:行者123 更新时间:2023-12-04 03:58:27 26 4
gpt4 key购买 nike

有谁知道这是什么原因造成的,我该如何解决?我正在尝试为我的项目安装一个 ruby​​ gem,这是一个在 rails 3 上运行的旧项目,但我在 ubuntu 20.04 上运行。我所做的基本上就是运行 bundle install ,然后我让除了这个 ruby​​ gem 之外的所有其他东西都能正常工作。请指教!

current directory: /home/decil/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR=" clean

current directory: /home/decil/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR="
compiling client.c
client.c: In function ‘nogvl_read_query_result’:
client.c:439:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
439 | my_bool res = mysql_read_query_result(client);
| ^~~~~~~
| bool
client.c: In function ‘rb_query’:
client.c:687:14: warning: passing argument 1 of ‘rb_rescue2’ from incompatible pointer type [-Wincompatible-pointer-types]
687 | rb_rescue2(do_send_query, (VALUE)&args, disconnect_and_raise, self, rb_eException, (VALUE)0);
| ^~~~~~~~~~~~~
| |
| VALUE (*)(void *) {aka long unsigned int (*)(void *)}
In file included from /home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby.h:33,
from ./mysql2_ext.h:8,
from client.c:1:
/home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1988:18: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(void *)’ {aka ‘long unsigned int (*)(void *)’}
1988 | VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
| ^~~~~~~~~~~~~~~
client.c:695:16: warning: passing argument 1 of ‘rb_rescue2’ from incompatible pointer type [-Wincompatible-pointer-types]
695 | rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0);
| ^~~~~~~~
| |
| VALUE (*)(void *) {aka long unsigned int (*)(void *)}
In file included from /home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby.h:33,
from ./mysql2_ext.h:8,
from client.c:1:
/home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1988:18: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(void *)’ {aka ‘long unsigned int (*)(void *)’}
1988 | VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
| ^~~~~~~~~~~~~~~
client.c: In function ‘_mysql_client_options’:
client.c:762:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
762 | my_bool boolval;
| ^~~~~~~
| bool
client.c:797:10: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
797 | case MYSQL_SECURE_AUTH:
| ^~~~~~~~~~~~~~~~~
| MYSQL_DEFAULT_AUTH
client.c:797:10: note: each undeclared identifier is reported only once for each function it appears in
client.c: In function ‘set_secure_auth’:
client.c:1185:38: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
1185 | return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
| ^~~~~~~~~~~~~~~~~
| MYSQL_DEFAULT_AUTH
client.c:1186:1: warning: control reaches end of non-void function [-Wreturn-type]
1186 | }
| ^
client.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
make: *** [Makefile:245: client.o] Error 1

最佳答案

我在 0.4.5 版上遇到了类似的问题,0.4.10 版对我来说效果很好
尝试在您的 Gemfile 上使用以下内容:

gem 'mysql2', '0.4.10'

关于ruby-on-rails - mysql2 Ruby Gem 无法安装 ubuntu 20.04,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63491235/

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