目前,我正在使用 JRuby 9.2.20.1 (2.5.8),并且收到以下错误:
2024-03-19T16:27:22.302+05:30 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED —-add-opens java.base/java.io=ALL-UNNAMED' to enable.
Your RubyGems version (3.1.6) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drop
s support for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning by running `gem update —-system 3.2.3`
/Users/***********/.rvm/gems/jruby-9.2.20.1/gems/bundler-2.3.26/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb:162: warning: Process#getrlimit not supported on this platform
warning: thread "Ruby-0-Thread-1: /Users/***********/.rvm/rubies/jruby-9.2.20.1/lib/ruby/stdlib/open3.rb:200" terminated with exception (report_on_exception is true):
NotImplementedError: waitpid unsupported or native support failed to load; see https://github.com/jruby/jruby/wiki/Native-Libraries
waitpid at org/jruby/RubyProcess.java: 936
git version 2.40.0
warning: thread "Ruby-0-Thread-4: /Users/***********/.rvm/rubies/jruby-9.2.20.1/lib/ruby/stdlib/open3.rb:200" terminated with exception (report_on_exception is true):
NotImplementedError: waitpid unsupported or native support failed to load; see https://github.com/jruby/jruby/wiki/Native-Libraries
waitpid at org/jruby/RubyProcess.java: 936
NotImplementedError: waitpid unsupported or native support failed to load; see https://github.com/jruby/jruby/wiki/Native-Libraries
waitpid at org/jruby/RubyProcess.java: 936
我尝试了不同版本的JRuby,但它给出了上述错误。以下是我的 M2 Mac 中的版本: jruby-9.2.20.1、jruby-9.2.9.0、jruby-9.4.6.0
屏幕截图中的第一条警告消息显示:
本机子进程控制需要对 JDK IO 子系统的开放访问
通过启用。--add-opens java.base/sun.nio.ch=ALL-UNNAMED —-add-opens java.base/java.io=ALL-UNNAMED
getrlimit
和 waitpid
方法相关。既然如此,我强烈建议首先将推荐的 --add-opens
选项传递给 JVM。 (请参阅配置 JRuby,了解如何在启动 JRuby 时将选项传递给 JVM。)
如果这没有帮助,您的错误消息还包含指向 JRuby wiki 上的 Native Libraries 页面的链接,该页面可能值得一看。虽然并非所有建议都一定适用于您的情况,但首要建议之一是将
-Xnative.verbose=true
命令行选项传递给 JRuby(或 -Djruby.native.verbose=true
直接传递给 JVM),这至少应该为您提供更详细的输出关于出了什么问题。
既然您说您使用 Apple Silicon (M2),您可能还想看看像 thisone 这样的报告。长话短说,较旧的 JRuby 版本可能无法完全支持 Apple Silicon 上的本机子进程控制等功能。我建议使用最新版本(当前是 JRuby 9.4.6.0),它修复了早期版本的许多问题。使用M2的IME,最新的9.3分支版本应该也可以,但是9.2可能不太好。