[MacRuby-devel] Stream of Consciousness Testing Log

Laurent Sansonetti lsansonetti at apple.com
Mon Mar 31 10:22:45 PDT 2008


Hi Pierce,

On Mar 31, 2008, at 10:04 AM, Pierce T. Wetter III wrote:
>
> Ok, so I have a rubycocoa application with source freely available.  
> So lets try to bootstrap it into MacRuby and see what happens.

That's courageous of you :-)

> So first, lets copy the Xcode project file, since it seems like at  
> this point there's no way to embed MacRuby directly so I'll have to  
> tweak some settings in the project, and I don't want to have to undo  
> them later when I go back to Rubycocoa. Or at least that's what I  
> had to do last time.
>
> Let's make a new project in Xcode to get the settings I need since  
> they don't seem to be documented in the Wiki.
>
> Hmmm... Making a new Ruby-Core Data application made what looks like  
> a RubyCocoa app.
>
> Ah, there's a new thing called User Templates now. Must be a tweak  
> because I'm using the iPhone SDK release of XCode.
>
> Ok, there's a Mac Ruby template project, loading that.
>
> Bringing up project settings to look for the settings...
>
> Hmmm... Don't see any. There were references to /usr/local last time  
> I tried this.
>
> Well, lets run it and see what happens...
>
> No joy, can't find MacRuby/MacRuby.h
>
> Ok, the project template is broken. Maybe there's a developer  
> example I can steal from instead.
>
> Trying DotView.
>
> Same problem. Ok, searching for the most recent xcoderproject  
> version. Hmm. ABPresence looks newer.
>
> Nope, doesn't build either.
>
> Hmmm.. There's a MacRuby.framework listed in the project files,  
> there didn't used to be.
>
> Trying to find it via locate.... no joy. Ok, ls /Library/Framework.
>
> I see it there. ls /Library/Framework/MacRuby/Framework
>
> Hmmm... I even see MacRuby.h:
>
> more /Library/Frameworks/MacRuby.framework/Headers/MacRuby.h
> #define RUBY_INCLUDED_AS_FRAMEWORK 1
> #include "ruby/ruby.h"
>
> Hmm... Pretty short.
>
> Ok, so unlike the last time I tried, MacRuby is now just a framework  
> to link against.

Since 0.1 actually, MacRuby can build as a framework, if you pass the  
"--enable-framework" option to configure. I think I will make this  
default in 0.2.

> Removing RubyCocoa.framework.
> Adding MacRuby.framework
>
> Opening the old main.m, saving it as main-mr.m, (which updates the  
> project to point at the new file), editing it to call macruby_main.
>
> Hmmm... Same problem, never heard of MacRuby/MacRuby.h
>
> Well, I'll just comment out the import for now. Works in ABPresence,  
> now lets try my app.
>
> ok, its building everything...I get a warning about macruby_main  
> being implicitly defined, yadda, yadda.
>
> Running...
>
> Hmmm....
>
> [Session started at 2008-03-31 09:46:42 -0700.]
> Assertion failed: (__auto_zone != NULL), function ruby_xmalloc, file  
> gc.c, line 296.
>
> The Debugger has exited due to signal 6 (SIGABRT).The Debugger has  
> exited due to signal 6 (SIGABRT).
>
> I'm guessing, but I bet that I have to turn GC on, because it has to  
> be OFF for RubyCocoa, but ON for MacRuby. Someone should put a  
> useful message on that assertion like "Hey dummy, turn on GC".

Excellent suggestion, I will do that. Could you file an entry in the  
tracker?

> Ok, changing that to "supported"
>
> Doesn't like Sparkle, because I built it without GC.
>
> Ok, turning that on and rebuilding Sparkle. Now where did I put that?
>
> Ah, there it is. Changing garb to supported.
>
> Hmm... Its grumping about osx/cocoa getting included in rb_main.rb.  
> Ok, doing my save-as trick again.
>
> Ah, that doesn't work because I have to change main-mr.m as well.
>
> Hmm... More problems because I'm using OSX:: Hey, I'm being a dummy,  
> I can just copy rb_main.rb from Address book.
>
> Ok, doing that, changing InstantMessage to CoreData.
>
> Sigh, another complaint on a different OSX.require_Framework. Let's  
> try this hack:
>
> class OSX
>
> 	def OSX.require_framework(foo)
> 		framework foo
> 	end
> end
>
> before the requires.

It is my objective to provide a RubyCocoa compatible layer on top of  
MacRuby, so that things like the OSX module or the underscore syntax  
would be temporarily supported. But I don't think I will do that for  
0.2.

At least I will provide more documentation in the wiki.

> Ok, running... That seems to work. But now I get:
>
> [Session started at 2008-03-31 09:58:55 -0700.]
> /Users/pierce/svnProjects/build/Debug/Frictionless.app/Contents/ 
> Resources/rb_main-mr.rb:13: [BUG] unresolved bridgesupport constant  
> `CFBinaryHeapCompareContext' not in cache
> MacRuby version 0.1 (ruby 1.9.0 2008-03-01) [universal-darwin9.0]
>
> -- control frame ----------
> c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :framework
> c:0003 p:0019 s:0007 b:0007 l:000006 d:000006 TOP    /Users/pierce/ 
> svnProjects/build/Debug/Frictionless.app/Contents/Resources/rb_main- 
> mr.rb:13
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
> c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP
> ---------------------------
> DBG> : "/Users/pierce/svnProjects/build/Debug/Frictionless.app/ 
> Contents/Resources/rb_main-mr.rb:13:in `<main>'"
> -- backtrace of native function call (Use addr2line) --
> 0x2a2146
> 0x1d60dc
> 0x1d611b
> 0x2acb0d
> 0x27e8d7
> 0x1cd9e4
> 0x2af0f4
> 0x2b2f93
> 0x2b2bcc
> 0x2b2bcc
> 0x2b5517
> 0x2a9f3a
> 0x2927c5
> 0x2a0510
> 0x299d92
> 0x29f71c
> 0x29f9f1
> 0x1d9afa
> 0x1df0df
> 0x2aa8cb
> 0x2561
> 0x2506
> -------------------------------------------------------
>
> The Debugger has exited due to signal 6 (SIGABRT).The Debugger has  
> exited due to signal 6 (SIGABRT).

That is a weird crash. In theory this message should be print only  
when you want to access a bridge support constant whose value hasn't  
been cached by the parser (which is definitely a bug, because the  
constant shouldn't be defined then). I suppose you're not accessing  
CFBinaryHeapCompareContext directly in your code.

Do you reproduce this all the time? If you could get a gdb backtrace  
it would be very helpful, or, if it's possible, please send me a copy  
of your project offlist and I will have a look at it.

Thanks for trying all of this, of course MacRuby is currently under  
heavy development, and I hope all these problems will disappear when  
we release a stable version.

Laurent


More information about the MacRuby-devel mailing list