Error while doing bundle install with jruby

37 Views Asked by At

Currently, I am using JRuby 9.2.20.1 (2.5.8) and I am getting the error below:

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

enter image description here

I have tried different versions of JRuby, but it is giving the above error. Below are the versions in my M2 Mac: jruby-9.2.20.1, jruby-9.2.9.0, jruby-9.4.6.0

1

There are 1 best solutions below

0
Ilmari Karonen On

The first warning message in your screenshot says:

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.

The errors below are related to the getrlimit and waitpid methods, which are used for subprocess control. That being the case, I would strongly suggest starting off by passing the recommended --add-opens options to the JVM. (See Configuring JRuby for how to pass options to the JVM when starting JRuby.)

If that doesn't help, your error messages also include a link to the Native Libraries page on the JRuby wiki, which is likely worth taking a look at. While not all the advice there will necessarily apply in your situation, one of the first recommendations is to pass the -Xnative.verbose=true command line option to JRuby (or -Djruby.native.verbose=true directly to the JVM), which should at least give you more detailed output about what's going wrong.

Since you say you're on Apple Silicon (M2), you might also want to take a look at reports like this one. Long story short, older JRuby versions may not fully support things like native subprocess control on Apple Silicon. I would recommend using the latest version (currently JRuby 9.4.6.0), which has fixed many of the problems with earlier versions. IME using M2, the latest 9.3 branch versions should also be OK, but 9.2 may be iffy.