Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rehash problem with rubinius master #178

Closed
Marchino opened this issue Jan 17, 2012 · 30 comments
Closed

rehash problem with rubinius master #178

Marchino opened this issue Jan 17, 2012 · 30 comments
Labels

Comments

@Marchino
Copy link

Hello,
I'm trying to get rubinius to work with rbenv but I'm having no luck with that.

What i did is:

  • compiled and installed rubinius to ~/.rbenv/versions/rbx-2.0.0-dev.
  • rbx console seems to work fine.
  • cd my-project-dir (which has a .rbenv-version file pointing to rbx-2.0.0-dev)
  • rbx gem install bundler
  • rbenv rehash
  • bundle install

What i get is :

rbenv: bundle: command not found

The `bundle' command exists in these Ruby versions:
1.9.2-p290
1.9.3-p0
1.9.3-preview1
rbx-1.2.4

I tried running bundle install from the gem folder with

~/.rbenv/versions/rbx-2.0.0-dev/gems/1.9/gems/bundler-1.0.21/bin/bundle install

and it worked (although it gave an error installing a gem, but that's not rbenv's fault).

Anyone has an idea on what's going on?

Thanks a lot

Marco

@mdippery
Copy link

I've noticed the same issue. I compiled/installed Rubinius, then installed bundler into Rubinius's gems, and ran rbenv rehash, but the bundle command could not be found.

@samflores
Copy link

+1 here, but I guess I found the reason. rbx-2.0.0-dev puts the binaries of its gems under ~/.rbenv/versions/rbx-2.0.0-dev/1.9/bin directory and the rbenv-which command only look for binaries under ~/.rbenv/versions/rbx-2.0.0-dev/bin.

@samflores
Copy link

Here's a rough solution for this problem: assuming you are using rubinius 1.9 mode (-X19), just create the file ~/.rbenv/rbenv.d/which/rbx-2.0.0-dev-fix.bash (the file can have any name, but must end with .bash) with the following content:

if [ ! -x "$RBENV_COMMAND_PATH" ] && [ "$RBENV_VERSION" = "rbx-2.0.0-dev" ]; then
  export RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/1.9/bin/${RBENV_COMMAND}"
fi

@samflores
Copy link

The previous comment solves the problem only if other ruby version have the gem you want to use (bundler in this case), otherwise the shims for Rubinius won't be created. For a complete fix, besides the previous file, create a file named ~.rbenv/rbenv.d/rehash/rbx-2.0.0-dev-fix.bash with the content:

make_shims ~/.rbenv/versions/rbx-2.0.0-dev/1.9/bin/*

@sstephenson
Copy link
Contributor

Why in the world does Rubinius create a 1.9/bin directory in the installation prefix?

@samflores
Copy link

According to @evanphx, it separates the gems and gems stubs installed in 1.8 and 1.9 modes.

@sstephenson
Copy link
Contributor

So if you installed Rubinius into /usr/local you'd have a /usr/local/1.9 directory on your system afterwards? Insanity.

If Rubinius is going to completely eschew Unix convention like that then I guess someone will have to write an rbenv plugin to support it.

@samflores
Copy link

It creates $RBX_ROOT/bin too, but puts only ruby, irb, gem (and others) there. The gems binaries are under $RBX_ROOT/1.9/bin.

@sstephenson
Copy link
Contributor

So it just overrides the RubyGems executable directory then?

@evanphx
Copy link

evanphx commented Jan 21, 2012

@sstephenson If you install rubinius into /usr/local, there won't be a /usr/local/1.9/bin. The 1.9 directory is under the data directory for rubinius, which will be /usr/local/rubinius/gems/1.9/bin.

If you see it installing into /usr/local/1.9, thats a bug.

@evanphx
Copy link

evanphx commented Jan 21, 2012

@sstephenson Yes, Rubinius never puts bin stubs into public directories like /usr/local/bin, etc because they'd too easily conflict with other rubies.

@evanphx
Copy link

evanphx commented Jan 21, 2012

Rubinius intends for the binstubs to almost always be accessed via -S, but you may put the internal gems/1.9/bin path in your PATH if you wish.

@sstephenson
Copy link
Contributor

Thanks for the clarification.

@lucapette
Copy link

Just run into the same issue. The fix by @samflores doesn't work for me and looks like a temporary solution. Any chance to get a proper fix? I'm not able to say it's a rbenv issue if @sstephenson thinks it's not something that can be fixed here we should find another way.

@lucapette
Copy link

OK, sorry for the noise. The suggested fix works just fine. Well, @sstephenson should we go for a plugin? I can do that...

@sstephenson
Copy link
Contributor

@lucapette, it'd be great if you could explore a plugin.

@collinschaafsma
Copy link

Would love some feedback on this plugin https://github.com/collinschaafsma/rbenv-rbx_2.0.0-dev_fix to fix the problem based off of @samflores suggestions. I'm not really sure what best practices are for rbenv plugin development, but this does fix the problem for me. thanks.

@samflores
Copy link

@collinschaafsma it looks fine, but I'd use $RBENV_ROOT rather ~/.rbenv since not everyone (including me) installs rbenv at $HOME. :)

@ashb
Copy link

ashb commented May 6, 2012

@collinschaafsma The latest rbx master might have changed. Your plugin is looking for rbx-2.0.0-dev/gems/1.9/bin/ but a fresh install of rubinus for me (via ruby-build) doesn't have that anymore.

Anyone know what's changed or what I did wrong?

@collinschaafsma
Copy link

@samflores good idea! I just pushed up the change. Thanks.

@ashb not sure, I tried this 3 days ago. Don't see anything that has changed in the commit history for rbx that would change the path like that. I didn't install from ruby-build, I just configured and compiled into my versions directory like so.
./configure --enable-version=1.8,1.9 --default-version=1.9 --prefix=~/.rbenv/versions/rbx-2.0.0-dev and then rake install hope that helps.

@cmhobbs
Copy link

cmhobbs commented Jul 6, 2012

Anything like that plugin for rubinius 1.2.4? I'm having the same issue.

@samgranieri
Copy link

@collinschaafsma thanks for your plugin. I can now play with rbx 2 in 1.9 mode, puma, celluloid and sidekiq.

@darkhelmet
Copy link

This hasn't been touch in 4 months and is still a problem. Is there something that can actually be done, or do we just use those two files? They are kind of annoying since you can't switch between 18 and 19 mode.

Is there anything I can do to help?

@hanshasselberg
Copy link

@collinschaafsma Thanks! Your plugin worked for me!

@mislav
Copy link
Member

mislav commented Jan 1, 2013

This was solved as a plugin and is too specific to Rubinius to be handled from rbenv itself. I've documented the caveat in the wiki and will go ahead and close the issue now because the problem is pretty much solved.

Yes, it will still probably bite some people in the future, but we believe that's a problem of Rubinius not rbenv. Hopefully they'll search for solutions and find either the plugin or our wiki page.

@mislav mislav closed this as completed Jan 1, 2013
@rmm5t
Copy link

rmm5t commented Jan 16, 2013

I ran into this same issue with rbenv and rubinius earlier today, but also ran into some problems with the rbenv-rbx_2.0.0-dev_fix plugin because of different Rubinius version numbers (2.0.0-dev vs 2.0.0-rc1, etc) and also because the rbx binstup directory convention changed.

I decided to fork and release a somewhat more official rbenv-rbx plugin. The goal is to support varying rbx 2.0+ versions in both 1.8 or 1.9 mode. Please give is a test. Contributions are welcome.

@mhenrixon
Copy link

Seems to still be an issue for me and the plugin hasn't helped either. Suggestions?

@mislav
Copy link
Member

mislav commented Oct 5, 2013

@mhenrixon: how did you install rbx? Which version? Which Ruby mode you're running in (1.8, 1.9, 2.0)? Which plugin didn't work for you?

@lcowell
Copy link

lcowell commented Oct 5, 2013

I'm also having this issue. Is there anything I can do to investigate ?

@mhenrixon
Copy link

It was solved with rbenv/ruby-build#419

mislav added a commit that referenced this issue Oct 6, 2013
Rubinius 2.0 configures RubyGems to install gem binstubs in
`PREFIX/gems/bin` instead of just `PREFIX/bin`.

The reason given by evanphx is that Rubinius wants to avoid RubyGems'
binstubs conflating with those from other Rubies. http://git.io/XBWGew

Fixes #178
mislav added a commit to rbenv/ruby-build that referenced this issue Oct 20, 2013
Rubinius 2 insists that it installs RubyGems binstubs into
`PREFIX/gems/bin` instead of `PREFIX/bin`.

This creates complexity for rbenv rehash and exec processes, so we
symlink `gems/bin` into `bin` and have RubyGems create binstubs at a
location that is consistent with other Ruby implementations.

See rbenv/rbenv#178, rbenv/rbenv#461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.