[odb-users] libc++abi.dylib: terminating with uncaught foreign exception

Boris Kolpackov boris at codesynthesis.com
Mon Oct 27 02:49:28 EDT 2014


Hi Christian,

Christian Sell <christian at gsvitec.com> writes:

> - command line build links against libc++
> - qt build links against libstdc++ (for reason of some OSX backwards
> compatibility)

Thanks for sharing! This will definitely explain what we are seeing.
BTW, how did you resolve this? Did you force QtCreator to use libc++
or did you re-build the ODB runtimes to use libstdc++? In the latter
case I wonder if Qt uses the system libstdc++ (found in /usr/lib on
my machine) or ships its own version (which will be a yet another
level of pain in the butt).

In the meantime I've tried to rebuild the ODB runtimes to use system
libstdc++. For some reason passing -stdlib=libstdc++ to clang is not
enough, one also has to explicitly link to -lstdc++:

clang -stdlib=libstdc++ sizeof_funds.cxx -L/usr/lib -lstdc++

[That -L/usr/lib is necessary in my case because I have another
 libstdc++ in /usr/local/lib.]

With that knowledge I was able to re-build the runtimes to use 
libstdc++:

make distclean
./configure CC=clang CXX="clang++ -stdlib=libstdc++" LDFLAGS=-L/usr/lib LIBS=-lstdc++
make
sudo make install

And then the example:

clang++ -stdlib=libstdc++ -c person-odb.cxx
clang++ -stdlib=libstdc++ -c -DDATABASE_SQLITE driver.cxx
clang++ -stdlib=libstdc++ -o driver person-odb.o driver.o -lodb-sqlite -lodb -L/usr/lib -lstdc++

otool -L ./driver
./driver:
        /usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

Boris



More information about the odb-users mailing list