无法在 macOS 12 上安装 puma,因为出现 SSL 错误。

huangapple go评论133阅读模式
英文:

Unable to install puma on macOS 12 due to SSL error

问题

我在尝试安装puma gem时遇到以下错误。Ruby已安装并使用rvm(1.29.12-next)。我认为问题与openSSL有关,但我不知道具体是什么问题。我通过homebrew安装了openSSL。

  • Ruby 3.0.6
  • macOS: 12.6.1

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

  1. Gem::Ext::BuildError: ERROR: Failed to build gem native extension. [0/383]
  2. current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11
  3. /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
  4. checking for BIO_read() in -llibcrypto... no
  5. checking for BIO_read() in -lcrypto... yes
  6. checking for SSL_CTX_new() in -lssl... yes
  7. checking for openssl/bio.h... yes
  8. checking for DTLS_method() in openssl/ssl.h... no
  9. checking for SSL_CTX_set_session_cache_mode(NULL, 0) in openssl/ssl.h... yes
  10. checking for TLS_server_method() in openssl/ssl.h... no
  11. checking for SSL_CTX_set_min_proto_version(NULL, 0) in openssl/ssl.h... no
  12. checking for X509_STORE_up_ref()... no
  13. checking for SSL_CTX_set_ecdh_auto(NULL, 0) in openssl/ssl.h... no
  14. checking for SSL_CTX_set_dh_auto(NULL, 0) in openssl/ssl.h... no
  15. checking for SSL_get1_peer_certificate() in openssl/ssl.h... no
  16. checking for Random.bytes... yes
  17. creating Makefile
  18. current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11
  19. make DESTDIR\= clean
  20. current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11
  21. make DESTDIR\=
  22. compiling http11_parser.c
  23. compiling mini_ssl.c
  24. mini_ssl.c:329:32: error: implicit declaration of function 'SSL_CTX_get0_param' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  25. X509_VERIFY_PARAM *param = SSL_CTX_get0_param(ctx);
  26. ^
  27. mini_ssl.c:329:32: note: did you mean 'SSL_CTX_set1_param'?
  28. /Users/tony/.rvm/usr//include/openssl/ssl.h:1824:5: note: 'SSL_CTX_set1_param' declared here
  29. int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
  30. ^
  31. 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]
  32. X509_VERIFY_PARAM *param = SSL_CTX_get0_param(ctx);
  33. ^ ~~~~~~~~~~~~~~~~~~~~~~~
  34. 1 warning and 1 error generated.
  35. make: *** [mini_ssl.o] Error 1
  36. make failed, exit code 2
英文:

I am running into the following error when trying to bundle install the puma gem. Ruby is installed with rvm (1.29.12-next). I believe the issue has something to do with openSSL, but i have no idea how exactly. I have openSSL installed via homebrew.

  • Ruby 3.0.6
  • macOS: 12.6.1

The only other similar question i've found was this one but the only suggestion there is to try a newer version of Ruby; this isn't an option for me as I specifically need 3.0.6 to be compatible on Heroku's heroku-20 platform

  1. Gem::Ext::BuildError: ERROR: Failed to build gem native extension. [0/383]
  2. current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11
  3. /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
  4. checking for BIO_read() in -llibcrypto... no
  5. checking for BIO_read() in -lcrypto... yes
  6. checking for SSL_CTX_new() in -lssl... yes
  7. checking for openssl/bio.h... yes
  8. checking for DTLS_method() in openssl/ssl.h... no
  9. checking for SSL_CTX_set_session_cache_mode(NULL, 0) in openssl/ssl.h... yes
  10. checking for TLS_server_method() in openssl/ssl.h... no
  11. checking for SSL_CTX_set_min_proto_version(NULL, 0) in openssl/ssl.h... no
  12. checking for X509_STORE_up_ref()... no
  13. checking for SSL_CTX_set_ecdh_auto(NULL, 0) in openssl/ssl.h... no
  14. checking for SSL_CTX_set_dh_auto(NULL, 0) in openssl/ssl.h... no
  15. checking for SSL_get1_peer_certificate() in openssl/ssl.h... no
  16. checking for Random.bytes... yes
  17. creating Makefile
  18. current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11
  19. make DESTDIR\= clean
  20. current directory: /Users/tony/.rvm/gems/ruby-3.0.6/gems/puma-6.3.0/ext/puma_http11
  21. make DESTDIR\=
  22. compiling http11_parser.c
  23. compiling mini_ssl.c
  24. mini_ssl.c:329:32: error: implicit declaration of function 'SSL_CTX_get0_param' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  25. X509_VERIFY_PARAM *param = SSL_CTX_get0_param(ctx);
  26. ^
  27. mini_ssl.c:329:32: note: did you mean 'SSL_CTX_set1_param'?
  28. /Users/tony/.rvm/usr//include/openssl/ssl.h:1824:5: note: 'SSL_CTX_set1_param' declared here
  29. int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
  30. ^
  31. 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]
  32. X509_VERIFY_PARAM *param = SSL_CTX_get0_param(ctx);
  33. ^ ~~~~~~~~~~~~~~~~~~~~~~~
  34. 1 warning and 1 error generated.
  35. make: *** [mini_ssl.o] Error 1
  36. make failed, exit code 2

答案1

得分: 2

Ruby 3.1是第一个支持OpenSSL 3的版本,没有计划将OpenSSL 3支持回溯到Ruby <= 3.0.x。当您想要安装早于3.1的Ruby版本(例如您的情况下的3.0.6)时,您必须使用OpenSSL 1.1。

要修复您的设置,我建议以下步骤:

  1. 卸载所有版本的OpenSSL

  2. 卸载Ruby

  3. 重新安装OpenSSL@1.1:

    1. brew install openssl@1.1
  4. 重新安装Ruby 3.0.6并链接到OpenSSL 1.1:

    1. rvm install 3.0.6 --with-openssl-dir=$(brew --prefix openssl@1.1)
英文:

Ruby 3.1 was the first version supporting OpenSSL 3 and there are no plans to back port OpenSSL 3 support to Ruby <=3.0.x. When you want to install a Ruby version prior to 3.1 (like 3.0.6 in your case) then you have to use OpenSSL 1.1.

To fix your setup, I suggest the following steps:

  1. Uninstall all versions of OpenSSL

  2. Uninstall Ruby

  3. Reinstall OpenSSL@1.1 with

    1. brew install openssl@1.1
  4. Reinstall Ruby 3.0.6 with linking to OpenSSL 1.1 with:

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

huangapple
  • 本文由 发表于 2023年7月13日 19:23:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76678818.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定