Reputation: 31
I'm trying to set up the Ruby for kids tutorial, and am completely stuck on the first step. Something with my GOSU GEM instalation is wring. Whenever I try and run the main file as requested I get this error:
internal:lib/rubygems/custom_require:29:in require': no such file to load -- gosu (LoadError) from internal:lib/rubygems/custom_require>:29:in require'
from main.rb:1:in `main'
I have run the $ sudo gem install gosu
many times in different locations, upon studying the outcome I've located this:
ERROR: Error installing gosu:
ERROR: Failed to build gem native extension.
/Users/carlosamengual/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
The Gosu gem requires some libraries to be installed system-wide. See the following site for a list: https://github.com/jlnr/gosu/wiki/Getting-Started-on-Linux
I'm assuming I'm doing something wrong. I've visited the site it says, but I believe, since it is a ruby project I don't need anything else? Can anyone advise as to how to fix it?
Upvotes: 3
Views: 2751
Reputation: 11
Be sure you using rbenv or install ruby by homebrew. Rvm is not compatible with gosu. Install homebrew: https://brew.sh/ .
Then:
brew install sdl2
brew install libogg libvorbis
brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force
And have fun!
look at: https://github.com/gosu/gosu/wiki/Getting-Started-on-OS-X
Upvotes: 1
Reputation: 3785
If you are using Ruby Gosu on OSX, you might want to go here:
https://github.com/gosu/gosu/wiki/Getting-Started-on-OS-X
For what it is worth, I'm currently using Ubuntu 14 with Ruby 2.3 and using rvm 1.11.3.9 I have downloaded gosu 0.10.8 and successfully gotten a gosu window to load. I had the same problem while starting off with Ruby Gosu and using "bundler" in the project directory took care of the gem dependency. In addition to visiting this website:
https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux
and after entering this in the command line:
user@ubuntu:~/Ruby/gosu_project$ sudo apt-get install build-essential libsdl2-dev libsdl2-ttf-dev libpango1.0-dev libgl1-mesa-dev libfreeimage-dev libopenal-dev libsndfile-dev
user@ubuntu:~/Ruby/gosu_project$ gem install gosu
I also had to invoke:
user@ubuntu:~/Ruby/gosu_project$
bundle
http://bundler.io/ - also works with MacOSX...
per: https://github.com/gosu/gosu/wiki/ruby-tutorial
This gosu file:
# basic Gosu: gui test file
require 'gosu'
require_relative 'gosu_test.rb'
class TestWindow < Gosu::Window # <-- inherits from Gosu Window Super class
def initialize
super 640, 480, false # <-- width, height, fullscreen = false
self.caption = "successful gosu test window"
end
def update
end
def draw
end
end
TestWindow.new.show
...loads a 640x480 window
user@ubuntu:~/Ruby/gosu_project$ ruby gosu_test.rb
Upvotes: 0
Reputation: 3413
I had similar issue whilst installing on OS X 10.9.4 although am not sure the version has much to do with it, but ruby version is ruby-2.1.2
To resolve this, I installed these additional dependencies for Gosu which fixed the problem:
brew install sdl2 libogg libvorbis
Then run gem install gosu as usual.
Upvotes: 4