[MacRuby-devel] BridgeSupport crash

Nathaniel Talbott nathaniel at talbott.ws
Fri Apr 15 19:40:14 PDT 2011

On Fri, Apr 15, 2011 at 9:07 PM, Matt Aimonetti <mattaimonetti at gmail.com> wrote:

> Thanks for the report Nathaniel. Before I forget, the latest version of
> BridgeSupport is preview 3, not preview 2 http://www.macruby.org/files/
>  (small detail but you are not the first one to mention that).

Good clarification - I ended up trying preview3 as well, with the same
results. FYI, someone should probably update this page, as I think
it's where a lot of the confusion is coming from:


I hadn't seen the http://macruby.org/files page - maybe that should be
linked more prominently?

> Here is my understanding of the problem. The --bs flag includes in your app
> the bs files that found in your machine. (so if you have BSp2, these files
> will be included).

Right. And if those files are embedded in the app using --bs, the app
crashes in macruby_main well before my code is ever run. If they are
not, the app runs fine, at least until I try to call a function or
reference a constant that is only included in the preview2/preview3
BridgeSupport, and even then it doesn't crash, it simply errors.

> Once you deploy your app to another machine, you probably only embedded the
> MacRuby framework, therefore the machine has the old BS version that ships
> with Snow Leopard. At this point, the new BS file is loaded in the old BS
> and that's when the problem occurs.
> In other words, the new BS files are not compatible with the old BS. That's
> quite a problem indeed. My guess is that Apple is planning on shipping the
> new BS in Lion. Updating the old BS via a system update would probably break
> some code relying on the old format. So I'm not really sure what the
> solution is.

As I understand it, the BridgeSupport files are simply declarative -
they're XML describing the underlying frameworks, but aren't code
themselves. The reason one needs to update to a newer version is to
pick up definitions of functions and constants that the BridgeSupport
files that ship with 10.6 didn't yet declare. Thus the idea behind the
--bs flag and the fact that MacRuby looks in the
Resources/BridgeSupport directory before looking BridgeSupport up in
the standard places: by embedding the most recent specifications of
the underlying code, we can call it without having to have up-to-date
BridgeSupport files at the OS level.

Thus, if the BridgeSupport files from my computer (preview2+) are
embedded, and MacRuby correctly loads them up if they're embedded, it
should all work. The underlying code being called is exactly the same,
and there should be no issue. So I think there are two possibilities:
I totally don't understand BridgeSupport (completely possible!) or
there's simply a bug in the MacRuby code that loads BridgeSupport
files from Resources/BridgeSupport.

Of course, I could be completely off in my understanding of
BridgeSupport - can't wait to hear from Laurent.

Nathaniel Talbott

More information about the MacRuby-devel mailing list