dlib-android icon indicating copy to clipboard operation
dlib-android copied to clipboard

Undefined reference errors while generating libandroid_dlib.so

Open ashokbugude opened this issue 7 years ago • 2 comments

I am trying to generate libandroiddlib.so , but getting undefined reference errors as shown below

ashok@ashok-Latitude-E5440:~/AndroidStudioProjects/dlib-android-master/dlib-android-master$ ndk-build -j 2 TOP Level Path: /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/miniglog/Android.mk:5: "Build miniglog.so/miniglog.a" /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/miniglog/Android.mk:8: /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/miniglog jni/jni_common/Android.mk:10: "Build jni_common" jni/jni_common/Android.mk:16: jni/jni_common "Won't build test's executable file" Android NDK: WARNING:jni/jni_common/Android.mk:jni_common: LOCAL_LDLIBS is always ignored for static libraries
[arm64-v8a] SharedLibrary : libandroid_dlib.so [arm64-v8a] Install : libc++_shared.so => libs/arm64-v8a/libc++_shared.so /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_objdetect.a(haar.cpp.o): In function cvHaarDetectObjectsForROC(void const*, CvHaarClassifierCascade*, CvMemStorage*, std::vector<int, std::allocator<int> >&, std::vector<double, std::allocator<double> >&, double, int, int, CvSize, CvSize, bool)': haar.cpp:(.text._Z25cvHaarDetectObjectsForROCPKvP23CvHaarClassifierCascadeP12CvMemStorageRSt6vectorIiSaIiEERS5_IdSaIdEEdii6CvSizeSC_b+0x1f2c): undefined reference to std::__throw_length_error(char const*)' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_objdetect.a(haar.cpp.o): In function _GLOBAL__sub_I_haar.cpp': haar.cpp:(.text.startup._GLOBAL__sub_I_haar.cpp+0x1c): undefined reference to std::ios_base::Init::Init()' haar.cpp:(.text.startup._GLOBAL__sub_I_haar.cpp+0x20): undefined reference to std::ios_base::Init::~Init()' haar.cpp:(.text.startup._GLOBAL__sub_I_haar.cpp+0x38): undefined reference to std::ios_base::Init::~Init()' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_imgcodecs.a(loadsave.cpp.o): In function cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)': loadsave.cpp:(.text._ZN2cv8imencodeERKNS_6StringERKNS_11_InputArrayERSt6vectorIhSaIhEERKS6_IiSaIiEE+0xca4): undefined reference to std::__throw_length_error(char const*)' loadsave.cpp:(.text._ZN2cv8imencodeERKNS_6StringERKNS_11_InputArrayERSt6vectorIhSaIhEERKS6_IiSaIiEE+0xcd0): undefined reference to std::__throw_length_error(char const*)' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_imgcodecs.a(loadsave.cpp.o): In function _GLOBAL__sub_I_loadsave.cpp': loadsave.cpp:(.text.startup._GLOBAL__sub_I_loadsave.cpp+0x18): undefined reference to std::ios_base::Init::Init()' loadsave.cpp:(.text.startup._GLOBAL__sub_I_loadsave.cpp+0x1c): undefined reference to std::ios_base::Init::~Init()' loadsave.cpp:(.text.startup._GLOBAL__sub_I_loadsave.cpp+0x30): undefined reference to std::ios_base::Init::~Init()' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): In function cv::empty_output_buffer(jpeg_compress_struct*)': grfmt_jpeg.cpp:(.text._ZN2cvL19empty_output_bufferEP20jpeg_compress_struct+0x1bc): undefined reference to std::__throw_length_error(char const*)' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): In function cv::JpegDecoder::readHeader()': grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0xbc): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0xcc): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0xd8): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x118): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x124): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x3b0): undefined reference to std::string::_Rep::_M_destroy(std::allocator const&)' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x3d8): undefined reference to std::string::_Rep::_M_destroy(std::allocator<char> const&)' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x408): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x418): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x448): undefined reference to std::string::_Rep::_M_destroy(std::allocator const&)' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): In function cv::term_destination(jpeg_compress_struct*)': grfmt_jpeg.cpp:(.text._ZN2cvL16term_destinationEP20jpeg_compress_struct+0x1c8): undefined reference to std::__throw_length_error(char const*)' /home/ashok/AndroidStudioProjects/dlib-android-master/dlib-android-master/third_party/opencv/jni/../libs/arm64-v8a/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): In function cv::JpegDecoder::getOrientation()': grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder14getOrientationEv+0x28): undefined reference to std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const*, unsigned long, std::allocator const&)' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder14getOrientationEv+0x38): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder14getOrientationEv+0x44): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder14getOrientationEv+0x88): undefined reference to std::string::_Rep::_S_empty_rep_storage' grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder14getOrientationEv+0x108): undefined reference to std::string::_Rep::_M_destroy(std::allocator const&)'

ashokbugude avatar Sep 28 '17 08:09 ashokbugude

Having the same issue. It seems to me, it's because opencv expects gnustl, whereas dlib needs c++ stl. were you able to solve this?

agrawal-git avatar Oct 06 '17 10:10 agrawal-git

Hi, did anyone solve this problem?

isamabdullah88 avatar Sep 28 '18 02:09 isamabdullah88