[英]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.