ruby 由于SSL错误,无法在macOS 12上安装puma

7fyelxc5  于 2023-08-04  发布在  Ruby
关注(0)|答案(1)|浏览(125)

我在尝试捆绑安装puma gem时遇到了以下错误。rvm(1.29.12-下一个)安装了Ruby。我相信这个问题与openSSL有关,但我不知 prop 体是怎么回事。“我已经通过自制软件安装了openSSL。

  • Ruby3.0.6
  • Mac操作系统:12.6.1

我找到的唯一一个类似的问题是was this one,但唯一的建议是尝试一个新版本的Ruby;这对我来说不是一个选项,因为我特别需要3.0.6才能与Heroku的heroku-20平台兼容

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.                                                                                                                                                                                                                                                   [0/383]
                                                                               
current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11                                                                       
/Users/tony/.rvm/rubies/ruby-3.0.6/bin/ruby -I /Users/tony/.rvm/rubies/ruby-3.0.6/lib/ruby/3.0.0 -r ./siteconf20230713-8369-4of5qc.rb extconf.rb              
checking for BIO_read() in -llibcrypto... no
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes 
checking for DTLS_method() in openssl/ssl.h... no
checking for SSL_CTX_set_session_cache_mode(NULL, 0) in openssl/ssl.h... yes
checking for TLS_server_method() in openssl/ssl.h... no
checking for SSL_CTX_set_min_proto_version(NULL, 0) in openssl/ssl.h... no
checking for X509_STORE_up_ref()... no
checking for SSL_CTX_set_ecdh_auto(NULL, 0) in openssl/ssl.h... no
checking for SSL_CTX_set_dh_auto(NULL, 0) in openssl/ssl.h... no
checking for SSL_get1_peer_certificate() in openssl/ssl.h... no
checking for Random.bytes... yes
creating Makefile            
                                                                               
current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11                                                                           
make DESTDIR\= clean    
                                                                               
current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11                                                                           
make DESTDIR\=                 
compiling http11_parser.c       
compiling mini_ssl.c      
mini_ssl.c:329:32: error: implicit declaration of function 'SSL_CTX_get0_param' is invalid in C99 [-Werror,-Wimplicit-function-declaration]                   
    X509_VERIFY_PARAM *param = SSL_CTX_get0_param(ctx);
                               ^
mini_ssl.c:329:32: note: did you mean 'SSL_CTX_set1_param'?
/Users/tony/.rvm/usr//include/openssl/ssl.h:1824:5: note: 'SSL_CTX_set1_param' declared here                                                                  
int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
    ^                           
mini_ssl.c:329:24: warning: incompatible integer to pointer conversion initializing 'X509_VERIFY_PARAM *' (aka 'struct X509_VERIFY_PARAM_st *') with an expression of type 'int' [-Wint-conversion]                                                                                                                         
    X509_VERIFY_PARAM *param = SSL_CTX_get0_param(ctx);
                       ^       ~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.    
make: *** [mini_ssl.o] Error 1                                    

make failed, exit code 2

字符串

mspsb9vt

mspsb9vt1#

Ruby 3.1是第一个支持OpenSSL 3的版本,目前还没有计划将OpenSSL 3支持移植到Ruby <=3.0.x。如果你想安装Ruby 3.1之前的版本(比如你的例子中的3.0.6),那么你必须使用OpenSSL 1.1。
要修复您的设置,我建议执行以下步骤:
1.卸载所有版本的OpenSSL
1.卸载Ruby
1.重新安装OpenSSL@1.1

brew install openssl@1.1

字符串
1.重新安装Ruby 3.0.6并链接到OpenSSL 1.1:

rvm install 3.0.6 --with-openssl-dir=$(brew --prefix openssl@1.1)

相关问题