在 mac os 上安装 ruby 2.6.7 时出错 - 如何解决? [英] Error installing ruby 2.6.7 on mac os - how to resolve?
本文介绍了在 mac os 上安装 ruby 2.6.7 时出错 - 如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试将 Ruby 升级到 2.6.7 时出现以下错误:
I get the following error when trying to upgrade Ruby to 2.6.7:
$ rbenv install 2.6.7
...
implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99
vm.c:2489:34: warning: expression does not compute the number of elements in this array; element type is 'const int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
sizeof(ec->machine.regs) / sizeof(VALUE));
~~~~~~~~~~~~~~~~ ^
vm.c:2489:34: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
有修复吗?
推荐答案
是的,这是上游的一个已知问题:https://bugs.ruby-lang.org/issues/17777
ruby-build 也在跟踪这个问题:https://github.com/rbenv/ruby-构建/问题/1489
Yes, this is a known issue upstream: https://bugs.ruby-lang.org/issues/17777
ruby-build is also tracking this issue: https://github.com/rbenv/ruby-build/issues/1489
解决方法是运行以下代码,然后再次安装 ruby 2.6.7:
The work around is to run the following code, and install ruby 2.6.7 again:
$ export warnflags=-Wno-error=implicit-function-declaration
$ rbenv install 2.6.7
-or-
$ CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.6.7
看起来这也会影响带有本机扩展的 gem 安装(mysql2
就是其中之一):
Looks like this can also impact gem installation with native extensions (mysql2
is one of those):
gem install <GEMNAME> -- --with-cflags="-Wno-error=implicit-function-declaration"
这篇关于在 mac os 上安装 ruby 2.6.7 时出错 - 如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文