在ruby中运行make install时出现RVM错误

abithluo  于 12个月前  发布在  Ruby
关注(0)|答案(1)|浏览(437)

在安装Ruby 2.7.2时,我得到了这个错误:

Error running '__rvm_make -j10',
please read /Users/rifa.fauzi/.rvm/log/1692949367_ruby-2.7.2/make.log

There has been an error while running make. Halting the installation.

当我检查make.log文件时,下面是error

CFLAGS = -w -ggdb3 -Wno-error=implicit-function-declaration -std=gnu99  -fno-common -pipe 
compiling error.c
compiling regerror.c
./miniruby -I./lib -I. -I.ext/common  ./tool/transform_mjit_header.rb "gcc  -w -ggdb3 -Wno-error=implicit-function-declaration -std=gnu99  -fno-common -pipe " rb_mjit_header.h .ext/include/arm64-darwin22/rb_mjit_min_header-2.7.2.h
compiling dataerror.c
ossl_pkey_rsa.c:942:5: error: use of undeclared identifier 'RSA_SSLV23_PADDING'
1 error generated.
make[2]: *** [ossl_pkey_rsa.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2

顺便说一句,我使用RVM(rvm install 2.7.2)安装了ruby:https://rvm.io/rvm/security#alternatives
我已经在谷歌上搜索了错误,但仍然找不到任何解决方案。

8xiog9wr

8xiog9wr1#

最后,我可以通过以下方式解决这个问题:https://github.com/postmodern/ruby-install/issues/409#issuecomment-926767470
在我的Mac中,默认的OpenSSL是版本3,如果基于spickermann的答案,Ruby 2.7.x不支持OpenSSL 3,需要OpenSSL 1。然后要解决这个问题,您需要卸载OpenSSL 3:

  • brew uninstall openssl
  • brew uninstall openssl@3
  • brew uninstall [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)

然后使用brew安装OpenSSL 1:

  • brew install [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)

最后,使用rvm和OpenSSL 1安装ruby 2.7.2:

  • rvm install 2.7.2 -- --with-openssl-dir=$(brew --prefix [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection) )

这解决了我的问题。

相关问题