Forums Archived

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

[BUG] Bus Error

Get help and support with Rubygame

[BUG] Bus Error

Postby hereandnow » Tue May 04, 2010 11:37 am

Hi!
I have ruby 1.9.1 installed on my Mac Os X via apt-get:
Code: Select all
sudo apt-get install ruby19


And rubygames and rsdl installed via gem1.9.

I want to run simple code (template from tutorial):
Code: Select all
#!/usr/bin/env ruby

$Verbose=true

require 'rubygems'
require 'rubygame'

include 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


The blue window appears for a few seconds, and then i receive an error in the Terminal:
Code: Select all
new-host:Desktop lukasz$ rsdl hello.rb
/opt/local/lib/ruby1.9/gems/1.9.1/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl/event.rb:317: [BUG] Bus Error
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin9]

-- control frame ----------
c:0008 p:---- s:0031 b:0031 l:000030 d:000030 CFUNC  :__SDL_PollEvent
c:0007 p:0043 s:0027 b:0027 l:000026 d:000026 METHOD /opt/local/lib/ruby1.9/gems/1.9.1/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl/event.rb:317
c:0006 p:0062 s:0022 b:0022 l:000021 d:000021 METHOD /opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/event.rb:39
c:0005 p:0072 s:0017 b:0016 l:000015 d:000015 METHOD /opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/queue.rb:133
c:0004 p:0015 s:0013 b:0013 l:000012 d:000012 METHOD /opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/queue.rb:109
c:0003 p:0171 s:0009 b:0009 l:001544 d:001c90 EVAL   hello.rb:22
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001544 d:001544 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
/opt/local/lib/ruby1.9/gems/1.9.1/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl/event.rb:317:in `__SDL_PollEvent'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/ruby-sdl-ffi-0.2/lib/ruby-sdl-ffi/sdl/event.rb:317:in `PollEvent'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/event.rb:39:in `fetch_sdl_events'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/queue.rb:133:in `fetch_sdl_events'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/queue.rb:109:in `each'
hello.rb:22:in `<main>'

-- C level backtrace information -------------------------------------------
0x2fd582 0   libruby1.9.dylib                    0x002fd582 rb_vm_bugreport + 82
0x21111c 1   libruby1.9.dylib                    0x0021111c rb_warning + 444
0x21117b 2   libruby1.9.dylib                    0x0021117b rb_bug + 43
0x2a30cb 3   libruby1.9.dylib                    0x002a30cb rb_enable_interrupt + 75
0x92ab82bb 4   libSystem.B.dylib                   0x92ab82bb _sigtramp + 43
0xffffffff 5   ???                                 0xffffffff 0x0 + 4294967295
0xc4b62 6   libSDL-1.2.0.dylib                  0x000c4b62 ConvertX86p32_8RGB332 + 3175
0x92d3942a 7   Foundation                          0x92d3942a NSZoneMalloc + 1770
0x9737147a 8   CoreFoundation                      0x9737147a _CFXNotificationResetSessionForTask + 1514
0x97371753 9   CoreFoundation                      0x97371753 _CFXNotificationPostNotification + 179
0x92d36680 10  Foundation                          0x92d36680 NSPopAutoreleasePool + 5088
0x92d3fed8 11  Foundation                          0x92d3fed8 _NSDescriptionWithLocaleFunc + 5464
0x968ee5b6 12  AppKit                              0x968ee5b6 _NXSendWindowNotification + 1140
0x96a17ede 13  AppKit                              0x96a17ede _NXShowKeyAndMain + 366
0x96903265 14  AppKit                              0x96903265 _NSHandleCarbonMenuEvent + 5362
0x1448b7de 15  libSDL.dylib                        0x1448b7de ConvertX86p32_8RGB332 + 5619
0x1445e415 16  libSDL.dylib                        0x1445e415 SDL_PumpEvents + 53
0x1445e44b 17  libSDL.dylib                        0x1445e44b SDL_PollEvent + 11
0x143c757f 18  ffi_c.bundle                        0x143c757f rbffi_CallFunction + 1103
0x143cac08 19  ffi_c.bundle                        0x143cac08 rbffi_MethodHandle_CodeAddress + 168
0x143d24a5 20  ffi_c.bundle                        0x143d24a5 ffi_closure_raw_SYSV + 37
0x2e8f75 21  libruby1.9.dylib                    0x002e8f75 rb_iseq_compile + 1141
0x2ecc3c 22  libruby1.9.dylib                    0x002ecc3c rb_make_backtrace + 428
0x2ed7ea 23  libruby1.9.dylib                    0x002ed7ea rb_raise_method_missing + 922
0x2efdfb 24  libruby1.9.dylib                    0x002efdfb rb_raise_method_missing + 10667
0x2f4f84 25  libruby1.9.dylib                    0x002f4f84 rb_raise_method_missing + 31540
0x2f535f 26  libruby1.9.dylib                    0x002f535f rb_iseq_eval_main + 159
0x214279 27  libruby1.9.dylib                    0x00214279 ruby_exec_node + 169
0x21684e 28  libruby1.9.dylib                    0x0021684e ruby_run_node + 94
0x215f 29  rsdl                                0x0000215f SDL_main + 95
0x23ac 30  rsdl                                0x000023ac SDL_main + 684
0x92d3942a 31  Foundation                          0x92d3942a NSZoneMalloc + 1770
0x9737147a 32  CoreFoundation                      0x9737147a _CFXNotificationResetSessionForTask + 1514
0x97371753 33  CoreFoundation                      0x97371753 _CFXNotificationPostNotification + 179
0x92d36680 34  Foundation                          0x92d36680 NSPopAutoreleasePool + 5088
0x92d3fed8 35  Foundation                          0x92d3fed8 _NSDescriptionWithLocaleFunc + 5464
0x968f1df2 36  AppKit                              0x968f1df2 _NSSubclassOverridesSelector + 8449
0x968f1d01 37  AppKit                              0x968f1d01 _NSSubclassOverridesSelector + 8208
0x9686b81b 38  AppKit                              0x9686b81b _NSInitializeKillRing + 6437
0x9686b014 39  AppKit                              0x9686b014 _NSInitializeKillRing + 4382
0x92d5ea9f 40  Foundation                          0x92d5ea9f NSZoneRealloc + 3199
0x92d5e7af 41  Foundation                          0x92d5e7af NSZoneRealloc + 2447
0x92fae648 42  AE                                  0x92fae648 aeProcessAppleEvent + 724
0x92fae57e 43  AE                                  0x92fae57e aeProcessAppleEvent + 522
0x92fae425 44  AE                                  0x92fae425 aeProcessAppleEvent + 177
0x930c9981 45  HIToolbox                           0x930c9981 AEProcessAppleEvent + 38
0x968688e9 46  AppKit                              0x968688e9 _DPSNextEvent + 1189
0x96867f88 47  AppKit                              0x96867f88 _NSUpdateMenuRefWithChangedMenuItem + 2250
0x96860f9f 48  AppKit                              0x96860f9f _NSSetViewMultiClipDrawingHelper + 4866
0x2b40 49  rsdl                                0x00002b40 SDL_main + 2624
0x20c6 50  rsdl                                0x000020c6 start + 54

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap


Can U help me, please? What should I do?

PS. I don't have eventmachine and thin.
hereandnow
 
Posts: 3
Joined: Tue May 04, 2010 11:27 am

Re: [BUG] Bus Error

Postby shawn42 » Tue May 04, 2010 9:45 pm

OS X, Ruby, and SDL do not play nicely out of the box. Mac requires rsdl. That's the command you'll run instead of ruby. You can get rsdl via rubygems with gem install rsdl.

More info at:
http://rubygame.org/wiki/Mac_Installation_Guide
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: [BUG] Bus Error

Postby jacius » Tue May 04, 2010 11:57 pm

Silly shawn42, he's already using rsdl. :P

It looks like it's most likely a bug in the ruby-sdl-ffi library. In other words, it's probably my fault. I'll investigate and report back here later this evening or tomorrow.

[Update: I've just checked and this happens to me too, now. Which is actually good, because it means I can know when it's fixed.]

[Update 2: The code in ruby-sdl-ffi looks fine. This may be a bug in SDL, ffi, or ruby. But, I have no idea at the moment. I'll do more investigating tomorrow.]
User avatar
jacius
Site Admin
 
Posts: 131
Joined: Fri Feb 06, 2009 11:13 pm

Re: [BUG] Bus Error

Postby hereandnow » Wed May 05, 2010 10:36 am

Thanks. I'm waiting for a reply ;)

BTW. How other Mac users are using rubygame, if the simplest code runs with error?
Is there any other way to run rubygame scripts on Mac?

I'm newbie ;)
hereandnow
 
Posts: 3
Joined: Tue May 04, 2010 11:27 am

Re: [BUG] Bus Error

Postby shawn42 » Thu May 06, 2010 5:26 pm

Doh, Should have read the code snippet more carefully. :oops:
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: [BUG] Bus Error

Postby shawn42 » Thu May 06, 2010 5:31 pm

I was able to run the code no problems for over a minute with no errors.
I'm using ruby-1.9.1 via rvm with the latest rubygame

My SDL is installed via mac ports:
Code: Select all
shawn42@bits ~/tmp  $ sdl-config --version
1.2.14


Any advice on reproducing this?
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: [BUG] Bus Error

Postby hereandnow » Thu May 06, 2010 7:56 pm

I have sdl downloaded from official site:
Code: Select all
$ sdl-config --version
1.2.12


Edit:
I have installed SDL-mac-dlibs.tar.bz2 too ;)
hereandnow
 
Posts: 3
Joined: Tue May 04, 2010 11:27 am


Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron