在MacOS上使用rbenv安装JRuby时出现OpenSSL错误

hiz5n14c  于 2023-10-17  发布在  Ruby
关注(0)|答案(1)|浏览(120)

运行rbenv install jruby-9.4.2.0时出现以下错误。错误提示说OpenSSL不可用,但据我所知,它在多个地方和形式中可用(请参阅下面的“版本”)。我已经尝试了OpenSSL 3+和OpenSSL 1.1。我做错了什么?

/var/folders/nm/c044zc5d5b505n42t9v7z4dr0000gt/T/ruby-build.20230926153740.4346.GaTTYO/jruby-9.4.2.0 /var/folders/nm/c044zc5d5b505n42t9v7z4dr0000gt/T/ruby-build.20230926153740.4346.GaTTYO ~
ERROR:  While executing gem ... (Gem::Exception)
    OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
    /Users/2b-software-mac/.rbenv/versions/jruby-9.4.2.0/lib/ruby/stdlib/rubygems/request.rb:47:in `configure_connection_for_https'
    /Users/2b-software-mac/.rbenv/versions/jruby-9.4.2.0/lib/ruby/stdlib/rubygems/request/https_pool.rb:6:in `setup_connection'
    ...
    /Users/2b-software-mac/.rbenv/versions/jruby-9.4.2.0/bin/jgem:21:in `<main>'
    org/jruby/RubyKernel.java:1091:in `load'
    gem:4:in `<main>'

我也试着指定RUBY_CONFIGURE_OPTShere,但是没有用。

  • OpenSSL 3:
  • RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" rbenv install jruby-9.4.2.0
  • RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/homebrew/Cellar/openssl@3/3.1.3 rbenv install jruby-9.4.2.0
  • RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local rbenv install jruby-9.4.2.0
  • OpenSSL 1.1:
  • LDFLAGS="-L/usr/local/opt/ [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection) /lib" CPPFLAGS="-I/usr/local/opt/ [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection) /include" CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection) )" RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection) )" rbenv install jruby-9.4.2.0

相关版本

MacOS 13.5.2(M2)

$ openssl version
OpenSSL 3.1.3 19 Sep 2023 (Library: OpenSSL 3.1.3 19 Sep 2023)

$ gem info openssl 
openssl (3.2.0, 3.0.0)

$ gem info jruby-openssl     
jruby-openssl (0.9.4)

$ java --version
openjdk 21 2023-09-19
OpenJDK Runtime Environment Homebrew (build 21)
OpenJDK 64-Bit Server VM Homebrew (build 21, mixed mode, sharing)

$ rbenv -v
rbenv 1.2.0

$ ruby-build --version
ruby-build 20230919

$ rbenv global
3.1.2

$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin22]

$ brew list openssl
/opt/homebrew/Cellar/openssl@3/3.1.3/.bottle/etc/ (7 files)
/opt/homebrew/Cellar/openssl@3/3.1.3/bin/c_rehash
/opt/homebrew/Cellar/openssl@3/3.1.3/bin/openssl
/opt/homebrew/Cellar/openssl@3/3.1.3/include/openssl/ (135 files)
/opt/homebrew/Cellar/openssl@3/3.1.3/lib/libcrypto.3.dylib
/opt/homebrew/Cellar/openssl@3/3.1.3/lib/libssl.3.dylib
/opt/homebrew/Cellar/openssl@3/3.1.3/lib/engines-3/ (3 files)
/opt/homebrew/Cellar/openssl@3/3.1.3/lib/ossl-modules/legacy.dylib
/opt/homebrew/Cellar/openssl@3/3.1.3/lib/pkgconfig/ (3 files)
/opt/homebrew/Cellar/openssl@3/3.1.3/lib/ (4 other files)
/opt/homebrew/Cellar/openssl@3/3.1.3/share/doc/ (798 files)
/opt/homebrew/Cellar/openssl@3/3.1.3/share/man/ (5533 files)
t40tm48m

t40tm48m1#

brew install openssl
导出为~/.bash_profile
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
rbenv rehash
rbenv install jruby-9.4.2.0

相关问题