[英]Error installing ruby 2.6.7 on mac os - how to resolve?
尝试将 Ruby 升级到 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-build/issues/1489
解决方法是运行以下代码,并再次安装 ruby 2.6.7:
$ 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
就是其中之一):
gem install <GEMNAME> -- --with-cflags="-Wno-error=implicit-function-declaration"
除了遵循 Gavin 的回答之外,我还必须重新安装 readline。 brew reinstall readline
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.