Ruby 2.7.4 和 3.0.0 在 macOS Big Sur (11.2.3) 上失败:未声明的标识符 RSA_SSLV23_PADDING

Ste*_*son 11 ruby openssl

尝试在 Intel Mac 11.2.3 上安装 Ruby 2.7.4 和 Ruby 3,我在编译过程中看到以下错误(安装时使用ruby-install( https://github.com/postmodern/ruby-install ) 安装。我看到以下错误:

\n
                                                   ^\nossl_pkey_rsa.c:942:5: error: use of undeclared identifier \'RSA_SSLV23_PADDING\'\n    DefRSAConst(SSLV23_PADDING);\n    ^\nossl_pkey_rsa.c:877:58: note: expanded from macro \'DefRSAConst\'\n#define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))\n                                                         ^\n<scratch space>:144:1: note: expanded from here\nRSA_SSLV23_PADDING\n^\n107 warnings and 1 error generated.\nmake[2]: *** [ossl_pkey_rsa.o] Error 1\nmake[1]: *** [ext/openssl/all] Error 2\nmake: *** [build-ext] Error 2\n!!! Compiling ruby 2.7.4 failed!\n
Run Code Online (Sandbox Code Playgroud)\n

另外,仅供参考:

\n
\xe2\x9d\xaf openssl version\nLibreSSL 2.8.3\n
Run Code Online (Sandbox Code Playgroud)\n

whi*_*kid 12

仅供将来参考,如果有人遇到类似的情况,rvm只需使用brew卸载openssl@3并安装openssl@1.1

  • 这个答案救了我一命。对于更多上下文,如果有人在尝试通过“rvm”安装 ruby​​ 时遇到问题并看到类似这样的日志行,那么这可能是您的解决方案。`运行 '__rvm_make -j12' 时出错,请阅读 /User/xxx/.rvm/log/1677787143_ruby-xxx/make.log` 然后在该日志文件中: `make[1]: *** [ext/openssl/全部]错误2` (4认同)

Uil*_*ias 9

如果您已经使用rvm安装 ruby​​ 版本并已openssl@3安装,则可以通过运行以下命令来修复它:

rvm install 3.2.2 --with-openssl-dir=$(brew --prefix openssl@3)
Run Code Online (Sandbox Code Playgroud)

如果您还没有openssl@3安装,可以使用以下命令安装:

$ brew install openssl@3
Run Code Online (Sandbox Code Playgroud)

我在这个 Github 问题中找到了这个解决方案