rbenv/ruby-build

JRuby 9.2.x installation failing

senolfeldmann opened this issue · 6 comments

Environment Information

I experience the faulty behaviour with JRuby versions 9.2.16.0 to 9.2.21.0, Ubuntu 18.04 and openjdk-8
I tried using newer Ubuntu and openjdk versions without success. I have the same error on my local dev machine, a x86 Mac running MacOS 13.4.1.
Starting with JRuby 9.3.0.0 the installation works just fine

You can reproduce the bug by building the following Dockerimage

FROM ubuntu:18.04
SHELL ["/bin/bash", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
    autoconf bison build-essential bzip2 ca-certificates git libffi-dev libgdbm-dev libgdbm5 \
    libncurses5-dev libreadline6-dev libssl-dev libyaml-dev openjdk-8-jdk openssh-client wget zlib1g-dev \
    netbase

RUN git clone https://github.com/sstephenson/rbenv.git /root/.rbenv \
    && git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build \
    && rm -rfv /root/.rbenv/plugins/ruby-build/.git \
    && rm -rfv /root/.rbenv/.git \
    && /root/.rbenv/plugins/ruby-build/install.sh \
    && echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh \
    && echo 'eval "$(rbenv init -)"' >> /root/.bashrc \
    && echo 'gem: --no-rdoc --no-ri' >> /root/.gemrc

ENV PATH /root/.rbenv/shims:/root/.rbenv/bin:$PATH

RUN rbenv install jruby-9.2.16.0

Expected Behavior

The installation should succeed

Actual Behavior

The installation fails with the following error:

ERROR:  Could not find a valid gem 'jruby-launcher' (>= 0) in any repository
ERROR:  Possible alternatives: jruby-launcher

I temporarily circumvent the issue with the following, but this is just a bandaid fix:

sed -i 's|./ruby gem install jruby-launcher|wget https://rubygems.org/downloads/jruby-launcher-1.1.19-java.gem \&\& ./ruby gem install jruby-launcher-1.1.19-java.gem \&\& rm jruby-launcher-1.1.19-java.gem|' /root/.rbenv/plugins/ruby-build/bin/ruby-build
mislav commented

Thanks for reporting. I wonder if this is a problem with Rubygems shipping with JRuby < 9.3?

@headius: Any ideas on what ruby-build could do, if anything, to make installation of these versions of JRuby painless?

Right now ruby-build does this as part of the jruby installation process:

"$PREFIX_PATH"/bin/jruby gem install jruby-launcher
jsvd commented

Updating the rubygems using the last rubygems-update supported on ruby < 2.6 seems to solve the issue:

bin/jruby -S gem update --system 3.3.26 --no-document --no-post-install-message

Example:

/tmp ❯ tar -zxf ~/Downloads/jruby-dist-9.2.21.0-bin.tar.gz                            
/tmp ❯ cd jruby-9.2.21.0 

/tmp/jruby-9.2.21.0 ❯ bin/jruby -S gem install jruby-launcher --no-document
ERROR:  Could not find a valid gem 'jruby-launcher' (>= 0) in any repository
ERROR:  Possible alternatives: jruby-launcher

/tmp/jruby-9.2.21.0 ❯ bin/jruby -S gem update --system 3.3.26 --no-document --no-post-install-message
Updating rubygems-update
Fetching rubygems-update-3.3.26.gem
Successfully installed rubygems-update-3.3.26
Installing RubyGems 3.3.26
  Successfully built RubyGem
  Name: bundler
  Version: 2.3.26
  File: bundler-2.3.26.gem
Bundler 2.3.26 installed
RubyGems 3.3.26 installed
Regenerating binstubs
Regenerating plugins
[...]
RubyGems system software updated

/tmp/jruby-9.2.21.0 ❯ bin/jruby -S gem install jruby-launcher --no-document                          
Fetching jruby-launcher-1.1.19-java.gem
Building native extensions. This could take a while...
Successfully installed jruby-launcher-1.1.19-java
1 gem installed

Any ideas on what ruby-build could do, if anything

Well, JRuby 9.2 is no longer supported, so I'm not sure there's anything to be done.

mislav commented

@headius Thanks for chiming in. We did incorporate a known workaround that targets only JRuby 9.2 but not any later versions. The aim is to help JRuby 9.2 users to keep their setups working until they figure out a migration path to the latest JRuby.

@mislav Good idea! Thanks for putting in that extra effort to help our users!