couldn't link successfully when i use ndk-build to complile my opencv code on android platform

asked 2014-04-15 07:28:56 -0600

reply2010 gravatar image

updated 2014-04-15 20:31:14 -0600

hi, i use ndk-build to compile my opencv code for android.I have successful experience on the work.but,today i fail to success.this is my log under ndk-build:

 /cygdrive/e/EclipseSomkeDetect/obj/local/armeabi/libopencv_androidcamera.a(camera_activity.o):
In function 'CameraWrapperConnector::getPathLibFolder()': camera_activity.cpp:
(.text._ZN22CameraWrapperConnector16getPathLibFolderEv+0x38): 
undefined reference to 'dladdr' 
collect2: ld returned 1 exit status /cygdrive/d/android-ndk-r4-crystax/build/core/build-shared-library.mk:38: 
recipe for target '/cygdrive/e/EclipseSomkeDetect/obj/local/armeabi/libSmokeDetect.so' failed
make: *** [/cygdrive/e/EclipseSomkeDetect/obj/local/armeabi/libSmokeDetect.so] Error 1

could any expert tell me what is problem?several weeks ago,i compile opencv code successfully which include no cvcapture func .My current c++ code uses cvcapture func and could not link successfully.any message would be appreciated. someone tells you should add app_platform:=android-8 in application.mk,i try,but i fail.

edit retag flag offensive close merge delete

Comments

What I would suggest first: please use the latest NDK (r9d), the latest OpenCV4Android SDK (2.4.8 or even coming soon 2.4.9) and don't use Cygwin. Start from here: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html

Andrey Pavlenko gravatar imageAndrey Pavlenko ( 2014-04-15 09:41:17 -0600 )edit

thanks a lot.i follow your suggestion.i can success.but i find new problem.when i use my .so lib in eclipse android project,my run result: java.lang.ExceptionInInitializerError ...... Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]: 85 could not load needed library 'libopencv_java.so' .... i search on google,someone tells add OPENCV_LIB_TYPE:=STATIC in android.mk.i try in static library mode.but i get errors in ndk-build as below: "Compile++ thumb : SmokeDetect <= SmokeDetect.cpp SharedLibrary : libSmokeDetect.so ... error: undefined reference to 'std::istream::seekg(std::fpos<mbstate ... any comment? thanks

reply2010 gravatar imagereply2010 ( 2014-04-17 01:58:20 -0600 )edit