Skip to content

AOSP hardwera service(aidl) build commonAPI gen_code failed #3

@meiGming

Description

@meiGming

Using AIDL to generate native service,build commonAPI gen_code and AIDL platform_ndk.so
build failed: error message

external/libcxx/include/memory:4972:16: error: use of dynamic_cast requires -frtti
_Tp* __p = dynamic_cast<_Tp*>(__r.get());

this error message solution:Android.bp add :rtti :true
but cause a new problem,
ld.lld: error: undefined symbol: typeinfo for aidl::android::hardware::xxx::adcu_hmiservice::BnAdcuService

referenced by AdcuHmiServiceStub.cpp
out/soong/.intermediates/hardware/interfaces/xxx/adcu/default/android.hardware.xxx.adcu_hmiservice_bin/android_vendor.32_arm64_armvnterfaces/xxx/adcu/default/src/AdcuHmiServiceStub.o:(typeinfo for aidl::android::hardware::xxx::adcu_hmiservice::stub::AdcuHmiServiceStub)
did you mean: vtable for aidl::android::hardware::xxx::adcu_hmiservice::BnAdcuService
defined in: out/soong/.intermediates/hardware/interfaces/xxx/adcu/android.hardware.xxx.adcu_hmiservice-V1-ndk_platform/android_vendor.32_arm64_arid.hardware.xxx.adcu_hmiservice-V1-ndk_platform.so
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
13:49:29 ninja failed with: exit status 1

AIDL gencode build failed,
Have you ever encountered this problem
Android.bp

cc_binary {
name: "android.hardware.xxx.adcu_hmiservice_bin",
relative_install_path: "hw",
stl: "c++_shared",
init_rc: ["config/xxx-adcu_hmiservice1.rc"],
vintf_fragments: ["config/xxx-adcu_hmiservice1.xml"],
vendor: true,
owner:"omg",
srcs: [
"src/AdcuHmiServiceMain.cpp",
"src/AdcuHmiServiceStub.cpp",
],
//ldflags: ["-export-dynamic"],
shared_libs: [
"libbase",
"libbinder_ndk",
"android.hardware.xxx.adcu_hmiservice-V1-ndk_platform",
"libCommonAPI",
"libADCU_HmiService-someip",
],
local_include_dirs: ["include", "src", "include/aidl/android/hardware/xxx/adcu_hmiservice/"],

 cppflags: [                   
    "-DBOOST_LOG_DYN_LINK",
    "-D_GLIBCXX_USE_NANOSLEEP",
    "-fexceptions",
    "-Wc++17-extensions",
    "-Wno-non-virtual-dtor",
    "-Wno-unused-const-variable",
    "-Wno-unused-parameter",
    "-Wno-unused-private-field",
    "-Wno-unused-lambda-capture",
    "-Wno-unused-variable",
    "-Wno-unused-local-typedef",
    "-Wno-sign-compare",
    "-Wno-format",
    "-frtti",
    "-Wno-header-guard",
    "-Wno-overloaded-virtual",
    "-Wno-implicit-fallthrough",
    "-Wno-error",
    "-Bdynamic",
    "-Wno-shorten-64-to-32",
    "-D_GTHREAD_USE_MUTEX_INIT_FUNC",
    "-D_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC",],
   // rtti: true

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions