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*

My understanding is that, the android.hardware.gnss-V3-ndk.so build without 
`-frtti` and "nm -C android.hardware.gnss-V3-ndk.so | grep typeinfo" shows 
nothing confirmed that.

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!!

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-building+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/android-building/68dad82f-289b-4ae0-8da7-a06c019718a1n%40googlegroups.com.

Reply via email to