Or, in general, Is there a way to enable RTTI for library build from AIDL generated code.
I'm implementing GNSS HAL, and I'm using type_index in my code. So I will need to enable RTTI when I build it.
Seems I can add `Â Â rtti: true ` in the cc_binary or my Android.bp, but it will get error when it trying to link the lib. The error looks like this:
ld.lld: error: undefined symbol: typeinfo for aidl::android::hardware::gnss::BnGnssGeofence                                        Â
>>> referenced by GnssGeofence.cpp                                                                     Â
>>> Â Â Â Â Â Â Â out/soong/.intermediates/vendor/gm/hardware/impls/sensor/vendor.gm.gnss_sensors_service/android_vendor.34_arm64_armv8-a/obj/vendor/gm/hardware/impls/sensor/src/gnss/aidl/GnssGeofence.o:(typeinfo for aidl::android::hardware::gnss::GnssGeofence) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
>>> did you mean: vtable for aidl::android::hardware::gnss::BnGnssGeofence                                                 Â
>>> defined in: out/soong/.intermediates/hardware/interfaces/gnss/aidl/android.hardware.gnss-V3-ndk/android_vendor.34_arm64_armv8-a_shared/android.hardware.gnss-V3-ndk.so
Now the question is,Â
1. Is it possible to enable RTTI for gnss aidl only?
2. Is it safe to enable RTTI for gnss aidl?Â
I have spend almost 2 days trying find a way to enable it, google/chatGPT/Copilot, but can't find a way.Â
ChatGPT said there is a global setup for that, in build/soong/cc/config/global.go, to add that in cc_library. The global.go exists, but the cc_library doesn't. Â
There is something like
    // Flags used by lots of devices.  Putting them in package static variables
    // will save bytes in build.ninja so they aren't repeated for every file
    commonGlobalCflags = []string{
and I put the "-frtti" inside, seems not working. (not trigger the full build/clean build. just mma from my HAL repo). And even it works, seems too risky.
Any suggestions? Thanks very much!!