[odb-users] libc++abi.dylib: terminating with uncaught foreign
boris at codesynthesis.com
Wed Oct 15 22:45:06 EDT 2014
Adnan RIHAN <axel50397 at gmail.com> writes:
> What if I tell you that this exception (not even caught by std::exception)
> is raised ONLY when querying an object with relations (lazy or not). When
> I query an object with “id” and “name”, it works normally. Maybe I forgot
> to add something in the pragmas or else? Did you see something wrong or
> missing in my pragmas or something I could add?
Here is what I think happens:
You have built libodb* runtimes (libodb, libodb-sqlite, libodb-qt) with
GCC and you are building your application with Clang. How do I know you
are building it with Clang? Because the error is reported by libc++ and
that's Clang's C++ runtime; GCC runtime is called libstdc++ (you can
verify this by running otool -L on your executable and observing that
both of these libraries are loaded).
So what most likely happens is that the ODB runtime throws an exception
but it uses libstdc++'s implementation of exceptions, not libc++'s. As
a result, your application cannot catch it.
The easiest solution would be to rebuild the above ODB runtimes using
Clang instead of GCC. And don't try to rebuild the ODB compiler itself
with Clang, that should continue to use GCC. As the documentation states,
it is perfectly fine to use a C++ compiler other than GCC (Clang, VC++,
SunCC, etc) to build the ODB runtimes and your application.
More information about the odb-users