Issue
I'm attempting to convert an existing Android.mk based build to CMake and I'm having difficulty building CPP code with exceptions and rtti. The cpp build command generated contains -fno-exceptions and -fno-rtti by default. Adding them as ANDROID_CPP_FEATURES or as cppFlags only appends them to the build command after the default options and the build still fails.
I've searched quite a bit and aside from the few pages pertaining to CMake on Android, I get mostly old Android.mk results from the search.
There is nothing special in any of the CMakeLists.txt file, nothing that would add those options as I can tell.
None of the uncommented options below work.
build.gradle:
externalNativeBuild {
cmake {
arguments '-DANDROID_TOOLCHAIN=gcc',
'-DANDROID_PLATFORM=android-19',
// '-DANDROID_STL_FORCE_FEATURES=ON',
'-DANDROID_STL=gnustl_static'
//'-DANDROID_CPP_FEATURES=rtti'
//'-DANDROID_CPP_FEATURES=exceptions',
cppFlags "-fexceptions -frtti"
targets 'library2'
}
}
Options in build command:
<removed content> -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -frtti -fexceptions -frtti -O2 -DNDEBUG -fPIC -MD -MT <additional content>
Solution
Seems like the cppFlags do enable both the exceptions and rtti even if all four options are on the command line. I was seeing a different error.
Answered By - Gary Bak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.