Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is carotene_o4t and why does it cause issues with compiling a program using opencv with Qt on Android?

Tags:

android

opencv

qt

I'm using Qt to write an Android app, using opencv. I've set up everything so that my app runs correctly without opencv. However, after I included opencv 3.2 (by downloading the latest sdk and setting up the library paths), compilation fails with hundreds of undefined reference errors, all of them involving carotene_o4t.

C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/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()'
C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/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::cmpGE(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/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::cmpEQ(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'

... and so on.

What is this carotene_o4t, and how can I resolve this problem? Searching for these messages, Google returns with zero results.

The project file looks like this:

INCLUDEPATH += C:/opencv/OpenCV-android-sdk/sdk/native/jni/include

OPENCV3RDPARTYLIBS = C:/opencv/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a
OPENCVNATIVELIBS = C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a

LIBS += $$OPENCV3RDPARTYLIBS/liblibtiff.a \
    $$OPENCV3RDPARTYLIBS/liblibjpeg.a \
    $$OPENCV3RDPARTYLIBS/liblibjasper.a \
    $$OPENCV3RDPARTYLIBS/liblibpng.a \
    $$OPENCV3RDPARTYLIBS/libtbb.a \
    $$OPENCV3RDPARTYLIBS/libIlmImf.a

LIBS += $$OPENCVNATIVELIBS/libopencv_core.a \
    $$OPENCVNATIVELIBS/libopencv_flann.a \
    $$OPENCVNATIVELIBS/libopencv_imgproc.a \
    $$OPENCVNATIVELIBS/libopencv_highgui.a \
    $$OPENCVNATIVELIBS/libopencv_features2d.a \
    $$OPENCVNATIVELIBS/libopencv_calib3d.a \
    $$OPENCVNATIVELIBS/libopencv_ml.a \
    $$OPENCVNATIVELIBS/libopencv_objdetect.a \
    $$OPENCVNATIVELIBS/libopencv_photo.a \
    $$OPENCVNATIVELIBS/libopencv_stitching.a \
    $$OPENCVNATIVELIBS/libopencv_superres.a \
    $$OPENCVNATIVELIBS/libopencv_video.a \
    $$OPENCVNATIVELIBS/libopencv_videostab.a \
    $$OPENCVNATIVELIBS/libopencv_java3.so \
    $$OPENCVNATIVELIBS/libopencv_calib3d.a \
    $$OPENCVNATIVELIBS/libopencv_imgcodecs.a \
    $$OPENCVNATIVELIBS/libopencv_shape.a \
    $$OPENCVNATIVELIBS/libopencv_videoio.a \



SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
    ANDROID_EXTRA_LIBS = \
        $$PWD/../../../../opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_java3.so
}

The paths themselves seem to be correct, because if I don't include opencv.hpp in my code, it runs perfectly. On the other hand, having wrong paths in the project files prevent building it.

like image 417
vsz Avatar asked Jan 15 '17 19:01

vsz


1 Answers

You need to link with libtegra_hal.

It is included in the 3rdparty folder: sdk/native/3rdparty/libs/armeabi/libtegra_hal.a

like image 57
scx Avatar answered Oct 14 '22 18:10

scx