Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Gosu, Ubuntu and Ruby
- - By SPK Date 2011-10-16 13:24
So I finally got my old PC back.
The first thing I did was to install everything to get gosu work under Ubuntu.
But it won't work. Require 'gosu' can't load 'gosu' (LoadError).

In an irb session it works.
require 'gosu'
=> true

So I don't get it. I followed the instructions for "Getting Started on Linux".
I'm working with Ruby 1.9.2.
My IDE is Aptana.
But running the examples over the terminal doesn't work either. (LoadError)

Here are some information:
spk@spk-desktop:~$ gem -v
spk@spk-desktop:~$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
spk@spk-desktop:~$ which ruby
spk@spk-desktop:~$ which gem
spk@spk-desktop:~$ gem which gosu

I hope someone can help out there.
Parent - - By psylem Date 2011-10-16 14:21
Don't you have to require 'rubygems' first?
Parent - By SPK Date 2011-10-16 14:25
I tried it with and without rubygems.
There's no difference.
Parent - By psylem Date 2011-10-17 04:51
Well I followed the steps for ruby 1.8 on my Lucid Lynx machine and was able to run CptnRuby.rb through terminal no worries. Sorry didn't check what version you were trying until after I did that. Actually, I don't see 1.9.2 in the Lucid repo.
Parent - By psylem Date 2011-10-17 05:23
I got CptnRuby.rb running with ruby 1.9.1 and rubygems1.9.1, and I think I have an idea why yours is not working. Looks like your rubygems is set up wrong, have a look at the path above. Here's what I have now...

$ gem -v

$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]

$ gem which gosu
(checking gem gosu-0.7.37 for gosu)

Try a complete uninstall all rubygems and make sure only to get version 1.9.2 this time and maybe you'll have more luck.

First attempt with 1.9.1 I stuffed up and didn't install all the correct packages, so I went to google in search of help and found three more packages listed here... (libdrb-ruby and liberb-ruby and rdoc). Not sure if that helped at all as after that I realised I was just a noob and was trying to use ruby1.8 with rubygems1.9.1.
Parent - - By jlnr (dev) Date 2011-10-17 05:52
It looks suspicious that ruby is in /usr/local and gem is in /usr, at least to my Mac-ified eyes. I think it's just Ruby/Gems being completely broken in the Ubuntu package manager as usual. :) Have you tried rvm? (
Parent - By SPK Date 2011-10-17 09:00
I can't believe it. My project runs as it's supposed to do. :)

Big thanks. :)
I love rvm. <3

This is my setup now:

$ gem -v

$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

$ which ruby

$ gem which gosu

Important note is that the gem has to be installed with rvm gem install gosu.
gem install gosu didn't worked for me even after changing GEM_HOME.
Parent - - By RavensKrag Date 2011-10-21 01:46
Well, looks like I'm a bit late to the party but...

In versions of ubuntu prior to 11.10, the "ruby" package installs 1.8.  "ruby 1.9.1, 1.9.2 etc"  are packaged as ruby1.9 or ruby19 (forgot the specifics, sorry).  That may be part of your problem, as even when you install 1.9.1, the system will run ruby 1.8 when you use the "ruby" command.  I have update-alternatives set up (or rather I did) so that I could switch between the two without having to use rvm.  This "problem" seems to be consistent with your behavior.  I believe that in 11.10, Ubuntu actually sets up update-alternatives properly, so you can use 1.9.1 with the ruby command.

Then, to switch ruby versions you would use
sudo update-alternatives --config ruby
(that's a double-dash before the config)

So, I don't see it as ruby being broken in Ubuntu(at least, not any more ^_^), it's just packaged in such a way that external package management tools like rvm should be unnecessary.  Personally, I think it makes a good deal of sense.
Parent - - By erisdiscord Date 2011-10-21 04:48
It kind of seems like Ruby 1.9 has been pretty horribly broken on Ubuntu in the past, but I can't back that up. I know I've had some major headaches with it.

I wish these Linux distributions would just distribute vanilla binaries instead of dicking around and applying a bunch of their own patches to everything. We might get updated packages in a more timely manner if they'd just leave well enough alone. Still kinda sore that Ubuntu thinks Ruby 1.8 is the best choice for "default version" when 1.9 has been stable for over two years.
Parent - By RavensKrag Date 2011-10-21 05:53
It's still considered the default version by the ruby community at large, IMO.  I think the gosu community (or general game dev) is an exception, because we depend on the speed offered by the 1.9 series.  Not quite sure why this is still so, considering that almost all, if not all, of the best libraries are now compatible with 1.9.

Ok, I should probably concede again (I've done it before on this forum) that installing OpenGL support in ruby is weird on Ubuntu.  But the repository is the first place you should go when trying to install libraries of any kind, imo, and not external things such as gem.  Other than that, I've never had problems with ruby on Ubuntu.

I feel like the distros patch stuff because of security issues etc.  Perhaps some of those patches don't get accepted back into ruby proper, or it just takes too much time for that to happen, and the distros can't wait.  Either way, I totally stand by the current packaging system.

Though, as someone who's never had problems with the system, I'm probably in no position to make such a statement...
Up Topic Gosu / Gosu Exchange / Gosu, Ubuntu and Ruby

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill