chruby icon indicating copy to clipboard operation
chruby copied to clipboard

JRuby affecting other rubies

Open fgarcia opened this issue 9 years ago • 17 comments

Somehow JRuby rubies are affecting my MRI rubies.

First I install some MRI rubies:

ruby-build 2.2.1 /opt/rubies/2.2.1
ruby-build 2.1.5 /opt/rubies/2.1.5

And everything works fine until I install some JRuby version

ruby-build jruby-9.0.0.0.pre1 /opt/rubies/jruby-9.0.0.0.pre1

After this, every single use of bundler in MRI rubies will complain about jruby-launcher

> chruby 2.2.1
> bundler
Ignoring jruby-launcher-1.1.1-java because its extensions are not built.  Try: gem pristine jruby-launcher --version 1.1.1

fgarcia avatar Mar 26 '15 07:03 fgarcia

I'm having this issue as well. It looks like bundler checks for a jruby file in the $BINDIR in various places, and assumes you're using jRuby if it exists. For example:

ifeq (true,$(shell test -x $(BINDIR)/jruby && echo true))
RAKE=$(BINDIR)/jruby -S rake
else
RAKE=rake
endif

theunraveler avatar May 21 '15 16:05 theunraveler

Guessing that bundler is coming from the system. Run gem install bundler and that should install bundle(r) into ~/.gem/....

postmodern avatar May 27 '15 20:05 postmodern

Bundler was working OK before installing jruby, and despite the type command showing that the right binary was called, I also tried calling it directly with the full path.

fgarcia avatar May 28 '15 10:05 fgarcia

What does head $(which bundler) show?

postmodern avatar May 28 '15 15:05 postmodern

I'm having this happening too, it started only recently for me. Get that message when running things under MRI, switched to MRI via chruby.

Sounds like other users may be using chruby too, the problem maybe exhibits specifically under the sort of ENV-herding that chruby does to switch rubies?

$ bundle -v
Bundler version 1.9.4

$ head $(which bundler)

#!/opt/rubies/ruby-2.2.2/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

jrochkind avatar Jun 01 '15 19:06 jrochkind

This is my output:

$ chruby
  2.1.6
  2.2.1
* 2.2.2 
  jruby-9.0.0.0.pre2

$ bundle -v
Bundler version 1.9.9

$ head $(which bundler)
#!/opt/rubies/2.2.2/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

The warning of bundle install only appears after install jruby

$ bundle install
Ignoring jruby-launcher-1.1.1-java because its extensions are not built.  Try: gem pristine jruby-launcher --version 1.1.1
Resolving dependencies...

I solved this problem by removing my rubies and ~/.gem folders. However to reproduce this issue I installed jruby again and got the same warning. It stays there even if I delete jruby

fgarcia avatar Jun 01 '15 19:06 fgarcia

After deleting jruby I realized I could fix the warning by also removing the gem.

 gem uninstall jruby-launcher-1.1.1-java

So I am no longer sure this is a real chruby issue

fgarcia avatar Jun 01 '15 20:06 fgarcia

I don't understand how the gem got installed under chruby mri in the first place. I wouldn't want to delete the gem from my jruby gem installation, but it ought not to be there in MRI clearly.

I still don't understand what's going on.

jrochkind avatar Jun 01 '15 20:06 jrochkind

And indeed it does NOT seem to be installed under my MRI ruby.

Check out this confusing output, where running gem which first issues the jruby-launcher error message, then tells me there's no jruby-launcher gem installed.

$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin12.0]
$ gem which jruby-launcher
Ignoring jruby-launcher-1.1.1-java because its extensions are not built.  Try: gem pristine jruby-launcher --version 1.1.1
ERROR:  Can't find ruby library file or shared library jruby-launcher

If you delete the gem, you should make sure you are NOT deleting it from the actual jruby installation, as that would be undesirable.

jrochkind avatar Jun 01 '15 20:06 jrochkind

@postmodern, Any interest in fixing this or helping to figure out what's causing it? It's kind of annoying.

Is it not happening to everyone, but only to a few of us, some quirk of our install setup?

jrochkind avatar Jul 06 '15 18:07 jrochkind

Fairly busy, but I'm not quite sure how this error occurs. Does gem pristine help at all?

postmodern avatar Jul 06 '15 23:07 postmodern

So I can't run gem pristine jruby-launcher from MRI 2.2.2, becuase jruby-launcher isn't installed at all in MRI 2.2.2, and presumably isn't installable under MRI (trying it gets some confusing errors).

It's still really a mystery where that error message is coming from -- running just about anything involving gems in MRI 2.2.2 (including bundle exec) ends up outputting to console Ignoring jruby-launcher-1.1.1-java because its extensions are not built.

Just for the heck of it, I can try running gem pristine jruby-launcher --version 1.1.1 from Jruby....

Huh, that seems to have worked. How odd. chruby jruby ; gem pristine ..... Then switch back to MRI 2.2.2, the error message on any action seems to be gone. For now? Hopefully.

Very odd.

jrochkind avatar Jul 07 '15 15:07 jrochkind

What about gem pristin --all in MRI? Also, is another dependency pull in jruby-launcher in the Gemfile.lock?

postmodern avatar Jul 07 '15 17:07 postmodern

Oddly and while I can't explain, the gem pristine jruby-launcher in Jruby seems to have fixed the probelm exhibiting under MRI, so I can't reproduce it anymore myself, so can't test to see if a gem pristine --all in MRI would have fixed it.

I'm not sure if there was actually a Gemfile.lock involved at all though -- the problem could reproduce simply by doing a gem which anything, even, I think, in a directory that didn't have a Gemfile at all. Maybe. Can't reproduce anymore, so hard to say now. I'll let anyone else who is still reproducing follow up more, or come back if it happens again!

jrochkind avatar Jul 07 '15 17:07 jrochkind

I am not sure if this was the case before, but this is the current status:

ruby-build 2.2.0 /opt/rubies/2.2.0
ruby-build jruby-9.0.0.0 /opt/rubies/jruby-9000
chruby 2.2.0

Warnings everywhere about jruby-launcher

chruby jruby-9000
gem install jruby-launcher
chruby 2.2.0

Now everything is OK

fgarcia avatar Aug 11 '15 08:08 fgarcia

I get similar errors about extensions, without using any JRuby stuff.

El Capitan.

mcandre avatar Mar 04 '16 22:03 mcandre

Started happening for me again on a new machine. I can try to investigate more details, if you tell me what to look at. Otherwise, I'll just chruby jruby ; gem pristine jruby-launcher, which fixed it last time, and probably will again.

jrochkind avatar Aug 15 '16 19:08 jrochkind