Error installing ruby 2.6.7 on mac os - how to resolve?
Asked Answered
P

2

22

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

Is there a fix?

Phonometer answered 9/4, 2021 at 14:58 Comment(0)
P
41

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

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

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"
Phonometer answered 9/4, 2021 at 14:58 Comment(0)
U
4

Additionally to following Gavin's answer, I had to reinstall readline. brew reinstall readline

Unicuspid answered 20/4, 2021 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.