Ask Your Question
0

Order of the static library on Android

asked 2019-12-08 10:12:06 -0600

tham gravatar image

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-12-08 11:42:52 -0600

mvuori gravatar image

Bad news: it is not about simply ordering the libs...

I also use OpenCV for Android with Qt 5.12.3 and also couldn't make the application link. I couldn't find a way to make any prebuilt OpenCV version to work (I tried many variations of all the relevant components) and finally I understood and accepted that with v. 4 one needs to use shared libraries, that is, use .so files, not .a, and a version of OpenCV that is built for the NDK version used (which would be v. 19 for 5.12.3).

That meant self-building OpenCV. Luckily, there were recipes for that. If I remember correctly, I did it like here: https://www.tal.org/tutorials/build_o...

(Of course the commands need "some" tailoring depending on any particular development system organization.)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-12-08 10:12:06 -0600

Seen: 721 times

Last updated: Dec 08 '19