I'm trying to build a modified version of ios-ruby-embedded project with some extra gems, including the mruby-marshal gem from the mruby-mgems list (which includes a .cpp file). I can get it to build and run, but if I raise any exception the app crashes when it calls MRB_THROW
from error.c with the following message:
libc++abi.dylib: terminating with uncaught exception of type int
I suspect the problem is a conflict in how mRuby exception handling is being compiled and linked: according to the documentation, it can use either setjmp/longjmp handling or C++ exceptions if C++ code is included; however, I can't figure out what combination of configuration options I need to get it to work.
In order to get it to build I made some changes to the project:
- Add the conf.cxx sections for each target in the Rakefile (duplicating the settings in the conf.cc sections)
- Add the '-lc++' flag to 'Other Linker Flags' in the Xcode project I'm using (derived from the mruby-ios-example project)
- In the mruby-marshal project, use the mruby-pure-regexp gem instead of the mruby-onig-regexp dependency