1
votes

I tried to use OpenCV with Android inside Qt, but I cannot successfully link it inside Qt, I get some undefined reference errors to the side libraries (like libjpeg, libtegra_hal etc.). I used this SO answer as a reference guide.

This is my .pro file -

INCLUDEPATH += "$$PWD/../../External-Libraries/opencv-android/sdk/native/jni/include"

android {
# 3rd party libs
LIBS += \
    -L"$$PWD/../../External-Libraries/opencv-android/sdk/native/3rdparty/libs/armeabi-v7a"\
    -llibtiff\
    -llibjpeg\
    -llibjasper\
    -llibpng\
    -llibwebp\
    -lIlmImf\
    -ltbb\
    -ltegra_hal
# opencv libs
LIBS += -L"$$PWD/../../External-Libraries/opencv-android/sdk/native/libs/armeabi-v7a"\
    -lopencv_core\
    -lopencv_highgui\
    -lopencv_java3\
    -lopencv_calib3d\
    -lopencv_imgcodecs\
    -lopencv_imgproc\
    -lopencv_flann\
    -lopencv_features2d\
    -lopencv_ml\
    -lopencv_objdetect\
    -lopencv_photo\
    -lopencv_shape\
    -lopencv_stitching\
    -lopencv_superres\
    -lopencv_video\
    -lopencv_videoio\
    -lopencv_videostab
ANDROID_PACKAGE_SOURCE_DIR=$$PWD/android
}

I'm using Qt 5.8 and OpenCV 3.2.0. The errors are in this format -

libopencv_core.a: ... error: undefined reference to (method of one of the 3rd party libs)

This is an example -

libopencv_core.a(arithm.cpp.o):arithm.cpp:function cv::hal::cmp8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*): error: undefined reference to 'carotene_o4t::isSupportedConfiguration()'

Where carotene is a function of libtegra_hal.a. Is there any way to link the opencv libs with the 3rd party libs?

Thanks.

EDIT:

I can successfully compile and run the OpenCV 3.1.0 library, but not the 3.2.0 library.

1
I googled "undefined reference to 'carotene_o4t::isSupportedConfiguration", there are some hits - see stackoverflow.com/questions/41665655/…, it might give you some pointers. Try disabling Carotene as per the 3rd comment's advice.sashoalm
Thanks, will check it out. The problem is OpenCV 3.2.0 specificFadedCoder

1 Answers

0
votes

The workaround is: either use OpenCV 3.1.0 or older or compile OpenCV 3.2.0 with CAROTENE disabled.

I can't seem to find any other solutions for now.