Android: Can not enable rtti exceptions with MinGW generator
Hi,
I hava been trying to compile a lib using CMake 3.18 + MinGW64 + NDK r21b.
I hava tried ANDROID_CPP_FEATURES="rtti exception"
and ANDROID_STL_FORCE_FEATURES
to enable rtti and exceptions, but still show error
error: cannot use 'try' with exceptions disabled
In flags.make file generated by CMake i found-frtti -fexceptions
flags were overwrited.
# CMAKE generated file: DO NOT EDIT!
# Generated by "MinGW Makefiles" Generator, CMake Version 3.18
# compile CXX with D:/code/Android/NDK/android-ndk-r21b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
CXX_DEFINES = -DNOMINMAX
CXX_INCLUDES = -ID:\FacialAnimation\3rdparty\cereal -ID:\FacialAnimation\3rdparty\eigen-3.3.3 -ID:\FacialAnimation\3rdparty\plog -isystem D:\FacialAnimation\3rdparty\libs_android\opencv-4.1.0-ndk21-static\sdk\native\jni\include -isystem D:\FacialAnimation\3rdparty\libs_android\ncnn-20190908-armv7-ndk21\include\ncnn
CXX_FLAGS = -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -frtti -fexceptions -fPIC -fno-rtti -fno-exceptions -std=c++14
I remove -fno-rtti -fno-exceptions
of CXX_FLAGS and it works. And i don't know where the last -fno-rtti -fno-exceptions
flags are from. How to enable the rtti and exceptions
Edited by Brad King