Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Order of the static library on Android

As the title mentioned, what is the correct orders of the static library?

I am using Qt5.12.3 to build an android app, struggle with the order of static libraries of opencv.

What I have tried

LIBS += $${OPENCV_LIB_PATH}/libopencv_highgui.a \
        $${OPENCV_LIB_PATH}/libopencv_imgproc.a \
        $${OPENCV_LIB_PATH}/libopencv_dnn.a \
        $${OPENCV_LIB_PATH}/libopencv_imgcodecs.a \
        $${OPENCV_LIB_PATH}/libopencv_core.a

LIBS += $${OPENCV_3RD_PARTY_PATH}/libcpufeatures.a \
    $${OPENCV_3RD_PARTY_PATH}/liblibtiff.a \
    $${OPENCV_3RD_PARTY_PATH}/liblibjpeg-turbo.a \
    $${OPENCV_3RD_PARTY_PATH}/liblibjasper.a \
    $${OPENCV_3RD_PARTY_PATH}/liblibpng.a \    
    $${OPENCV_3RD_PARTY_PATH}/liblibwebp.a \
    $${OPENCV_3RD_PARTY_PATH}/libtbb.a \
    $${OPENCV_3RD_PARTY_PATH}/libIlmImf.a \
    $${OPENCV_3RD_PARTY_PATH}/libquirc.a \
    $${OPENCV_3RD_PARTY_PATH}/liblibprotobuf.a \
    $${OPENCV_3RD_PARTY_PATH}/libittnotify.a \
    $${OPENCV_3RD_PARTY_PATH}/libippiw.a \
    $${OPENCV_3RD_PARTY_PATH}/libippicv.a

I got error messages

../../../3rdLibs/opencv/opencv_4.1.2-android-sdk/sdk/native/staticlibs/x86/libopencv_imgcodecs.a(loadsave.cpp.o):loadsave.cpp:function cv::imread(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char="">, std::__ndk1::allocator<char> > const&, int): error: undefined reference to 'cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' ../../../3rdLibs/opencv/opencv_4.1.2-android-sdk/sdk/native/staticlibs/x86/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o):grfmt_jpeg2000.cpp:function cv::Jpeg2KDecoder::readData(cv::Mat&): error: undefined reference to 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' ../../../3rdLibs/opencv/opencv_4.1.2-android-sdk/sdk/native/staticlibs/x86/libopencv_imgcodecs.a(grfmt_pfm.cpp.o):grfmt_pfm.cpp:function cv::PFMDecoder::readData(cv::Mat&): error: undefined reference to 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' ../../../3rdLibs/opencv/opencv_4.1.2-android-sdk/sdk/native/staticlibs/x86/libopencv_imgcodecs.a(grfmt_tiff.cpp.o):grfmt_tiff.cpp:function cv::TiffDecoder::readData(cv::Mat&): error: undefined reference to 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' ../../../3rdLibs/opencv/opencv_4.1.2-android-sdk/sdk/native/staticlibs/x86/libopencv_imgcodecs.a(grfmt_tiff.cpp.o):grfmt_tiff.cpp:function cv::TiffDecoder::readData(cv::Mat&): error: undefined reference to 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

Tried with different orders, but none of them work, do anyone know the correct order?Thanks