在RHEL 8上安装gem mysql2 -v 0.3.21错误



我正在将我的应用程序复制到新服务器,因为旧服务器损坏了,但是在尝试运行bundle install时,gem mysql2安装失败。

[me@localhost redmine]$ 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.
current directory: /home/x-mwojciechow4/.rvm/gems/ruby-2.2.9/gems/mysql2-0.3.21/ext/mysql2
/home/x-mwojciechow4/.rvm/rubies/ruby-2.2.9/bin/ruby -I /home/x-mwojciechow4/.rvm/rubies/ruby-2.2.9/lib/ruby/site_ruby/2.2.0 -r ./siteconf20220613-3672195-xa12ap.rb 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()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib64/mysql
-----
creating Makefile
current directory: /home/x-mwojciechow4/.rvm/gems/ruby-2.2.9/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR=" clean
current directory: /home/x-mwojciechow4/.rvm/gems/ruby-2.2.9/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’?
my_bool res = mysql_read_query_result(client);
^~~~~~~
bool
client.c: In function ‘_mysql_client_options’:
client.c:762:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
my_bool boolval;
^~~~~~~
bool
client.c:797:10: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
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’?
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]
}
^
make: *** [Makefile:238: client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/x-mwojciechow4/.rvm/gems/ruby-2.2.9/gems/mysql2-0.3.21 for inspection.
Results logged to /home/x-mwojciechow4/.rvm/gems/ruby-2.2.9/extensions/x86_64-linux/2.2.0/mysql2-0.3.21/gem_make.out

我注意到的第一个错误是"检查rb_thread_blocking_region()…no"-然而,我没有找到任何有用的谷歌这。

对我来说保持相同的mysql2版本是很重要的,因为这是一个测试服务器,所以我希望它尽可能接近生产服务器。

系统:RHEL 8.1Ruby 2.2.9p480Rails 4.2.7.1MySql 8.0.29 MySql Community Server - GPL

0.3.21版本的mysql2 gem与MySQL 8.0不兼容

因此,除非有任何实际的问题,你应该更新你的gem版本(测试和生产)。mysql2 0.4.10 (0.4.x的最后一个版本)应该与您的Rails版本兼容,并支持MySQL 8.0。如果你也可以将Rails更新到至少4.2.11.3(你应该这样做,自4.2.7.1版本以来有很多安全修复),你也可以使用mysql2 0.5.x。

无论如何,你提到的所有ruby软件版本(即ruby本身,rails和mysql2)都是过时的,并且在各自的分支中不再接收任何更新。你应该把所有这些都更新到新的支持版本。

相关内容

  • 没有找到相关文章