Cygwin compiling custom OpenCV library error: Opencv_contrib:local_src_files points to a missing file

Source: Internet
Author: User

Today, I was ordered to help my brother to make a opencv4android. The procedure for identifying a bank card, version opencv4android2.4.9, is used in the first way described earlier, that is, through JNI calls OpenCV. As Zajia above, the accompanying NDK should use a higher version of android-ndk-r9d. Its installation is very simple, after decompression set environment variable to path on ok:d:\programfile\android-ndk-r9d;

Unfortunately, the same program is configured on a single PC by Cygwin compiling everything OK. But on a new computer, the following error occurred:

Android Ndk:error:jni/android.mk:local_src_files points to a missing file
Android ndk:check that././. /LIBS/ARMEABI-V7A/LIBOPENCV_CONTRIB.A exists or that it path is correct
/cygdrive/d/programfiles/android-ndk-r9d/build/core/prebuilt-library.mk:45***android NDK:Aborting. Stop

Said the Mk file Local_src_files pointed to the file can not be found, but in fact, MK configuration everything is normal. The most people have no words is said LIBOPENCV_CONTRIB.A exists or that it path is correct, good how to involve LIBOPENCV_CONTRIB.A, and this file is certain to exist.

After research, Link: http://zhidao.baidu.com/link?url=Fv_nHirMNwBRqeFAtfM-gQWSBFVXcpUhOfvnv_Ry5m_ Y1dmra7ktumoldb2gaqgcaxzukqvrrblbg8nx922cbldbd8dc9kpxsqqt293fuqa is also the same problem encountered. In addition, foreign HTTP://STACKOVERFLOW.COM/QUESTIONS/20014555/FAIL-TO-BUILD-OPENCV is the same problem, this link says:

Error clearly showlibopencv_contrib.afile is missing. NDK looking at/cygdrive/c/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/user/libs/armeabi-v7a/Location , but file not found. You can do be either include above path in the library search path for Example:ld_library_path in Linux or%PATH% in Windows. OR You can copylibopencv_contrib.aFile to the location . My suggestion would be include library path.

libopencv_contrib.a This file does not exist, everything is caused by the library cannot be found. Look very reasonable, follow this idea groping for two hours without solution, is simply nonsense. Finally miscellaneous household, not to say that the NDK since R7 can not Cygwin, Zajia in the previous article also introduced the configuration method, is the NDK installation directory of the Ndk-build.cmd in eclipse a new builder and then link in. It was not very useful at the time, mainly when the compilation was not controlled. But today, it feels like the development experience that this configuration method brings is far more than Cygwin! This method perfectly solves the error of opencv_contrib:local_src_files points to a missing file. Detailed instructions are attached below:

1, select the project with JNI, press the Alt+enter key, the left column to find builders, then click New, choose Program Point OK.




2, after the establishment of the new Builder, the name is Ndk_builder. Fill in the Ndk-builder.cmd path in the location: D:\ProgramFile\android-ndk-r9d\ Ndk-build.cmd

Select the current project in working directory to indicate that Ndk_builder is only valid for the current project. When selected, automatically fills in: ${workspace_loc:/scanbankcard}


3. In the Refresh bar, select the third one.


/span>

4, in the Build options, select during Auto builds This option is best not to choose, otherwise in the JNI write a sentence to save, automatically compile once, this is not very friendly. Just select the two items in the article is OK, want to compile so point clean project or manually compile.



remark: sometimes change the C code in JNI, be sure to clean the whole project, otherwise it might not compile .

The official guidance document on NDK and Opencv4android configuration is here: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/ Android_binary_package_using_with_ndk.html can be referenced below.

Note:

1, the official document is configured in the Refresh Bar Libs folder, this is not configured also OK.

2, my previous blog said can not configure Cygwin path D:\ProgramFile\cgwin\bin; in path, it seems to be wrong. This has to be configured. Can be used in my Computer environment variables, you can also refer to the official document in the new Builder's third setup bar environment added.

3. Still, Cygwin is worth it, sometimes it is very convenient to search for some information with its grep command, especially when looking at third-party code.

Welcome to join Opencv4android League QQ Group: 66320324 Remarks: Yanzi

------------------------This article is original, reprinted annotated author yanzi1225627


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.