2

I updated Android Studio to use the ndk18 and changed:

APP_STL := c++_static

This lead to a bunch of linker errors in OpenCv:

../thirdparty/opencv-android-sdk/sdk/native/jni/../libs/arm64-v8a/libopencv_objdetect.a(detection_based_tracker.cpp.o): In function `cv::DetectionBasedTracker::updateTrackedObjects(std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > > const&)':
detection_based_tracker.cpp:(.text._ZN2cv21DetectionBasedTracker20updateTrackedObjectsERKSt6vectorINS_5Rect_IiEESaIS3_EE+0xad8): undefined reference to `std::__throw_length_error(char const*)'
../thirdparty/opencv-android-sdk/sdk/native/jni/../libs/arm64-v8a/libopencv_objdetect.a(detection_based_tracker.cpp.o): In function `_GLOBAL__sub_I_detection_based_tracker.cpp':
detection_based_tracker.cpp:(.text.startup._GLOBAL__sub_I_detection_based_tracker.cpp+0x18): undefined reference to `std::ios_base::Init::Init()'
detection_based_tracker.cpp:(.text.startup._GLOBAL__sub_I_detection_based_tracker.cpp+0x1c): undefined reference to `std::ios_base::Init::~Init()'
detection_based_tracker.cpp:(.text.startup._GLOBAL__sub_I_detection_based_tracker.cpp+0x34): undefined reference to `std::ios_base::Init::~Init()'

How to fix this?

I am using OpenCv android sdk 3.1.

ssk
  • 9,045
  • 26
  • 96
  • 169

2 Answers2

1

You need to rebuild opencv against libc++.

Dan Albert
  • 10,079
  • 2
  • 36
  • 79
  • Example how to do it: https://stackoverflow.com/questions/52410712/ndk-problems-after-gnustl-has-been-removed-from-the-ndk-revision-r18/52436751#52436751 – y30 Sep 22 '18 at 16:33
0

you need to rebuild opencv based on NDK 18, i had done it with opencv 2.4

https://github.com/2666fff/opencv-for-android

Arthur
  • 189
  • 1
  • 6