Forums Archived

The forums are being archived. See this topic for more information.

Mac OS 10.6 Load Error

Get help and support with Rubygame

Mac OS 10.6 Load Error

Postby velrok » Wed Jan 13, 2010 1:32 pm

Hi.

I installed rubygame using MacPorts and gem. Everything seams fine, however when I try to run this hello world example I'm getting an error.
Any idears?

Hello World example Code:
Code: Select all
#!/usr/bin/env ruby

require 'rubygems'
require 'rubygame'

Rubygame.init

screen = Rubygame::Screen.set_mode [320,240]
screen.title = 'Hello World'
screen.fill [0,0,255]
screen.update

queue = Rubygame::EventQueue.new

game_over = false

until game_over do
  queue.each do |event|
    case event
      when Rubygame::ActiveEvent
        screen.update
      when Rubygame::QuitEvent
        game_over = true
    end
  end
end

Rubygame.quit


Terminal Output:
Code: Select all
rsdl rubygame_hello_world.rb
/Library/Ruby/Gems/1.8/gems/ffi-0.5.1-x86-darwin-9/lib/ffi_c.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/ffi-0.5.1-x86-darwin-9/lib/ffi_c.bundle, 9): no suitable image found.  Did find: (LoadError)
   /Library/Ruby/Gems/1.8/gems/ffi-0.5.1-x86-darwin-9/lib/ffi_c.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/ffi-0.5.1-x86-darwin-9/lib/ffi_c.bundle
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/ffi-0.5.1-x86-darwin-9/lib/ffi.rb:8
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/nice-ffi-0.2/lib/nice-ffi.rb:31
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl.rb:31
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame/main.rb:22
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame.rb:44
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame.rb:29:in `each'
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame.rb:29
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
   from rubygame_hello_world.rb:4
velrok
 
Posts: 3
Joined: Wed Jan 13, 2010 1:25 pm

Re: Mac OS 10.6 Load Error

Postby velrok » Wed Jan 13, 2010 1:52 pm

Ok I reinstalled ffi by executing:
Code: Select all
sudo gem install ffi


Now I have another problem:
Code: Select all
rsdl rubygame_hello_world.rb
/Library/Ruby/Gems/1.8/gems/ffi-0.5.4/lib/ffi/library.rb:77:in `attach_function': Function 'SDL_Linked_Version' not found in [/opt/local/lib/libSDL.dylib] (FFI::NotFoundError)
   from /Library/Ruby/Gems/1.8/gems/nice-ffi-0.2/lib/nice-ffi/library.rb:129:in `func'
   from /Library/Ruby/Gems/1.8/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl.rb:50:in `sdl_func'
   from /Library/Ruby/Gems/1.8/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl/core.rb:52
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl.rb:75
   from /Library/Ruby/Gems/1.8/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl.rb:63:in `each'
   from /Library/Ruby/Gems/1.8/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl.rb:63
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame/main.rb:22
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame.rb:44
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame.rb:29:in `each'
   from /Library/Ruby/Gems/1.8/gems/rubygame-2.6.2/lib/rubygame.rb:29
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
   from rubygame_hello_world.rb:4
velrok
 
Posts: 3
Joined: Wed Jan 13, 2010 1:25 pm

Re: Mac OS 10.6 Load Error

Postby velrok » Wed Jan 13, 2010 2:39 pm

Ok it works.

First I needed to reinstall libsdl (with universe option).
After that
Code: Select all
sudo gem install rsdl
and
Code: Select all
sudo gem install rubygame
worked.

Running the hello world program is now possible.
velrok
 
Posts: 3
Joined: Wed Jan 13, 2010 1:25 pm

Re: Mac OS 10.6 Load Error

Postby shawn42 » Thu Jan 14, 2010 6:39 pm

Thanks for going through this, I would have been doing the same thing next month when I got my new machine. :D
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm


Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron