STLport error: '__cxa_demangle' is not a member of 'abi' for boost library

1.9k views Asked by At

I have been trying to compile a piece of code which needs boost logging , things are fine when I try to compile with gnustl but when I switch to stlport the compiler, cribs loud with the following message.

In file included from   /boost/include/boost/log/attributes/attribute_value.hpp:23:0,
                 from /boost/include/boost/log/attributes/attribute_value_set.hpp:27,
                 from  /boost/include/boost/log/core/record.hpp:21,
                 from  /boost/include/boost/log/core/core.hpp:23,
                 from  /boost/include/boost/log/core.hpp:20,
                 from  /boost/include/boost/log/common.hpp:22,
                 from /MyApp/FrameWorkLog.cpp:30:
 /boost/include/boost/log/utility/type_info_wrapper.hpp: In member function 'std::string boost::log::v2s_mt_posix::type_info_wrapper::pretty_name() const':
 /boost/include/boost/log/utility/type_info_wrapper.hpp:131:33: error: '__cxa_demangle' is not a member of 'abi'

I don't want to use gnustl for many reason.

More information: The following is my Application.mk file configs

NDK_TOOLCHAIN_VERSION=4.6
APP_ABI := armeabi-v7a
APP_PLATFORM := android-14
APP_STL := stlport_static  # For Static build
APP_CPPFLAGS := -frtti -fexceptions  

Boost library version : 1.54.0

I tried building my app both 9c and 10b android ndk, but no difference.

1

There are 1 answers

4
jww On BEST ANSWER

/boost/include/boost/log/utility/type_info_wrapper.hpp:131:33: error: '__cxa_demangle' is not a member of 'abi'

Looking at the NDK's doc/CPLUSPLUS-SUPPORT.html, there's no mention of it. It looks like your have four choices.

First, you might be able to use Boost 1.56 because it appears type_info_wrapper.hpp does not use __cxa_demangle. I could be wrong, but I did not find it in the 1.56 header.

Second, configure Boost 1.54 such that BOOST_LOG_HAS_CXXABI_H is not defined. That will guard the use of abi::__cxa_demangle in 1.54's type_info_wrapper.hpp.

I don't know how to do it because I rarely use Boost, but I would probably hack it through config.hpp as follows. The Boost folks might know a bjam configuration option, so hopefully one of them will provide feedback.

// cxxabi.h availability macro
#if defined(BOOST_CLANG)
#   if defined(__has_include) && __has_include(<cxxabi.h>)
#       define BOOST_LOG_HAS_CXXABI_H
#   endif
#elif defined(__GNUC__) && !defined(__QNX__)
#   define BOOST_LOG_HAS_CXXABI_H
#endif

// Add these lines as a hack
#ifdef (__ANDROID__)
# undef BOOST_LOG_HAS_CXXABI_H
#endif

Third, try linking with one of the libraries that provide it. Unfortunately, it does not look like STLport provides it. It appears GAbi++ and GNU STL provide it:

$ cd /opt/android-ndk-r9/
$ find . -iname cxxabi.h
./sources/cxx-stl/gabi++/include/cxxabi.h
./sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi.h
./sources/cxx-stl/gnu-libstdc++/4.6/include/cxxabi.h
./sources/cxx-stl/gnu-libstdc++/4.7/include/cxxabi.h
./sources/cxx-stl/gnu-libstdc++/4.8/include/cxxabi.h

Fourth, port __cxa_demangle from one of the STL libraries that provide it. You can find the source code for the NDK libraries at Android Tools Project.