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

问题描述 投票:0回答:1

运行

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>'

我还尝试按照

here
here所述指定RUBY_CONFIGURE_OPTS,但没有成功。

  • 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:

相关版本

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)
ruby macos openssl jruby rbenv
1个回答
0
投票

brew install openssl

出口于

~/.bash_profile

export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

rbenv doctor

rbenv install jruby-9.4.2.0

© www.soinside.com 2019 - 2024. All rights reserved.