I develop some native libraries for Android and use Boost libraries - just headers-based ones. The problem I am facing is that when I try to link some of my native libraries against some system library the UnsatisfiedLinkError
is thrown. It is due to different C++ runtimes as stated in the NDK documentation:
You can only select a single C++ runtime that all your code will depend on. It is not possible to mix shared libraries compiled against different C++ runtimes.
System libraries do not use RTTI and Exceptions, but my libraries use it implicitly.
I know there are macros BOOST_EXCEPTION_DISABLE
and BOOST_NO_RTTI
, but I am not able to make it working. I tried to set them as compiler flags and in the config.hpp as well, but with no luck – still getting many errors like
cannot use typeid with -fno-rtti
How can I disable these features in Boost, is it even possible?
The answer is "maybe". Some boost libraries will work with exceptions disabled - some will not. Same for RTTI.
I suggest you check the documentation for the particular boost libraries that you are interested in.
For example, Boost.Array will work with exceptions disabled, but Boost.Format will not.
If you are getting messages like cannot use typeid with -fno-rtti
, that will probably be while compiling some part of Boost that requires RTTI. Where the error occurs will tell you which library (usually).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With