0

I'm trying to compile a Binder and OpenCV libraries in the same code. Everything is compiled and runs well separately, but when I'm trying to compile it together I get an error: error: undefined symbol: typeinfo

From looking on the internet I found that the problem is the mixing between the flags -frtti(needs for OpenCv) and -fno-rtti(Needs for Binder)

The OpenCv cannot run without frtti:

In file included from vendor/OpenCV-android-sdk/sdk/native/jni/include/opencv2/flann/params.h:35:
vendor/dolphin/OpenCV-android-sdk/sdk/native/jni/include/opencv2/flann/any.h:60:63: error: use of typeid requires -frtti
    virtual const std::type_info& type() CV_OVERRIDE { return typeid(T); }
                                                              ^
vendor/dolphin/OpenCV-android-sdk/sdk/native/jni/include/opencv2/flann/any.h:274:31: error: use of typeid requires -frtti
        if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast();
                              ^
vendor/dolphin/OpenCV-android-sdk/sdk/native/jni/include/opencv2/flann/any.h:283:31: error: use of typeid requires -frtti
        if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast();
                              ^
vendor/dolphin/OpenCV-android-sdk/sdk/native/jni/include/opencv2/flann/any.h:291:34: error: use of typeid requires -frtti
        return policy->type() == typeid(anyimpl::empty_any);
                                 ^
vendor/dolphin/OpenCV-android-sdk/sdk/native/jni/include/opencv2/flann/any.h:311:34: error: use of typeid requires -frtti
        return policy->type() == typeid(T);

And the Binder cannot run without the fno-rtti:

>>> referenced by binder.cpp
>>>               out/target/product/dolphin/obj/EXECUTABLES/binder_server_intermediates/binder.o:(construction vtable for android::IInterface-in-ReadQr)
>>> did you mean: VTT for android::IInterface
>>> defined in: out/target/product/dolphin/obj/SHARED_LIBRARIES/libbinder_intermediates/libbinder.so

ld.lld: error: undefined symbol: typeinfo for android::BBinder
>>> referenced by binder.cpp
>>>               out/target/product/dolphin/obj/EXECUTABLES/binder_server_intermediates/binder.o:(typeinfo for android::BnInterface<IReadQr>)
>>> referenced by binder.cpp
>>>               out/target/product/dolphin/obj/EXECUTABLES/binder_server_intermediates/binder.o:(construction vtable for android::BBinder-in-ReadQr)
>>> referenced by binder.cpp
>>>               out/target/product/dolphin/obj/EXECUTABLES/binder_server_intermediates/binder.o:(construction vtable for android::BBinder-in-ReadQr)
>>> did you mean: VTT for android::BBinder
>>> defined in: out/target/product/dolphin/obj/SHARED_LIBRARIES/libbinder_intermediates/libbinder.so

ld.lld: error: undefined symbol: typeinfo for android::IBinder
>>> referenced by binder.cpp
>>>               out/target/product/dolphin/obj/EXECUTABLES/binder_server_intermediates/binder.o:(construction vtable for android::IBinder-in-ReadQr)
>>> referenced by binder.cpp
>>>               out/target/product/dolphin/obj/EXECUTABLES/binder_server_intermediates/binder.o:(construction vtable for android::IBinder-in-ReadQr)
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
11:54:48 ninja failed with: exit status 1

Is there any other option to make them run together?

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87

0 Answers0