Opencv4android:non-system libraries in linker flags:-lopencv_java Error resolution

Source: Internet
Author: User

Recently engaged in an old code, found OpenCV to 2.4. After 11, the previous MK file was not used and reported a pile of errors.

First, as mentioned above, local_ldlibs + =-lm-llog this sentence + = must not be wrongly written: =. In addition, a bug is reported:

Android NDK:WARNING:APP_PLATFORM android-17 is larger than android:minsdkversion in./androidmanifest.xmlandroid NDK: Warning:jni/android.mk:processimg:non-system libraries in linker flags:-lopencv_javaandroid Ndk:this was likely to result in incorrect builds. Try using local_static_librariesandroid ndk:or local_shared_libraries instead to list the library dependencies of the Android ndk:current module[armeabi-v7a] compile++ thumb:processimg <= detectface_jni.cppjni/detectface_jni.cpp:i n function ' _jstring* java_org_yan_processlib_libprocessimg_processiplimg (jnienv*, Jobject, jintarray, int, int) ': JNI /detectface_jni.cpp:97:44:warning:converting ' false ' to pointer type for argument 2 of ' jint* _jnienv::getintarrayelemen                                            TS (Jintarray, jboolean*) ' [-wconversion-null] cbuf = Env->getintarrayelements (buf, false); ^jni/detectface_jni.cpp:in function ' _jstring* java_org_yan_processlib_libprocessimg_processstaticimg (JN Ienv*, Jobject, jintarray, int, int) ': Jni/detectface_jni.cpp:131:44:warning:converting ' false ' to pointer type for Argumen T 2 of ' jint* _jnienv::getintarrayelements (Jintarray, jboolean*) ' [-wconversion-null] cbuf = env->                                            Getintarrayelements (buf, false); ^[ARMEABI-V7A] compile++ thumb:processimg <= copytoassets.cpp[armeabi-v7a] compile++ thumb:processimg <= DETECTFACE.CPP[ARMEABI-V7A] sharedlibrary:libprocessimg.so/users/yanzi/work/android-ndk-r10d/toolchains/ arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/. /lib/gcc/arm-linux-androideabi/4.8/. /.. /.. /.. /arm-linux-androideabi/bin/ld:warning:hidden symbol ' __aeabi_atexit ' in/users/yanzi/work/android-ndk-r10d/sources /CXX-STL/GNU-LIBSTDC++/4.8/LIBS/ARMEABI-V7A/THUMB/LIBGNUSTL_STATIC.A (ATEXIT_ARM.O) is referenced by dso/users/ yanzi/work/opencv-android-sdk/sdk/native/jni/. /LIBS/ARMEABI-V7A/LIBOPENCV_JAVA.SO[ARMEABI-V7A] Install:libProcessImg.so = libs/armeabi-v7a/libprocessimg.so 

Although the so file was generated, it was installed, but reported a Non-system libraries in linker flags:-lopencv_java error, compiled so file only about 330KB, Theoretically this so should be around 4.5M. Run know find libopencv.so found. This is the Mk file that produces this error:

Local_path: = $ (call My-dir) include $ (clear_vars) ifeq ("$ (wildcard $ (Opencv_mk_path))", "") #try to the load opencv.mk from Def Ault Install location #include $ (toolchain_prebuilt_root)/user/share/opencv/opencv.mk include/users/yanzi/work/ Opencv-android-sdk/sdk/native/jni/opencv.mkelse include $ (opencv_mk_path) endiflocal_ldlibs    + =-lm-llog LOCAL_ MODULE    

The correct MK file should be as follows:

Local_path: = $ (call My-dir) include $ (clear_vars) opencv_install_modules:=onopencv_camera_modules:=offopencv_lib_ Type:=staticifeq ("$ (wildcard $ (Opencv_mk_path))", "") #try to the load OPENCV.MK from the default install location #include $ (TOOL Chain_prebuilt_root)/user/share/opencv/opencv.mk include/users/yanzi/work/opencv-android-sdk/sdk/native/jni/ Opencv.mkelse include $ (opencv_mk_path) endiflocal_module    : = processimg local_src_files: = Detectface_jni.cpp src/ CopyToAssets.cpp Src/detectface.cpplocal_ldlibs    

The problem is:

Opencv_install_modules:=on
Opencv_camera_modules:=off
Opencv_lib_type:=static

These three sentences, especially the opencv_lib_type:=static is the key, not this sentence compiled so or to rely on libopencv_java.so. And this sentence must be placed before the include Opencv.mk file . Remember, remember!


Welcome to join Opencv4android 3 Group: 272250397 Remarks: Yanzi

Opencv4android:non-system libraries in linker flags:-lopencv_java Error resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.