Tiny6410 's OpenCV2.4.2 transplant notes

Source: Internet
Author: User

About OPENCV in arm transplant Most classic should be this: Compile compilation OpenCV for Arm-linux

Last year in the case of the transplant is mainly rely on this article, wrote very detailed, if you think it is not enough detail, recommend a map: opencv2.3.1 at arm end of the transplant

This article is also good: Linux transplant opencv+qt to arm (Tiny6410) Summary

My environment is Ubuntu12.04, the board is a friendly arm of the tiny6410.

First of course is to install ARM-LINUX-GCC, configure environment variables, input arm-linux-gcc-v have output, this step is completed. Then is CMake, more convenient is the Cmake-gui with the interface, the place to pay attention to is cmakeinstallprefix and withtiff and cmakeexelinkerflags .

The first parameter needs attention is because we compile the library is applicable to arm, should not be placed directly in the/usr/local, otherwise if installed x86 OpenCV will have conflict, such as to/usr/local/opencv-arm. The second parameter usually needs to be removed because it seems that Ubuntu is not supported by default, and you have to choose what you want to install. The third parameter is because OPENCV requires support for both libraries. I also do not understand now, in short, add-LRT and-lpthread will not be an error. Other parameters remain the same as the basic will not be an error.

CMake after the next step is make, for dual-core machines with-J4 parameters faster, but also hot, in the System Monitor to see four threads of the CPU is nearly 100%, the fan has been whistling.

Then is the configuration of the compilation environment, as if after 2.3 OpenCV x86 version installed will have a pkgconfig. pc files. 2.3 The previous version is not clear

So the more convenient is to use Pkgconfig to configure, it's. pc file is under/usr/local/lib/pkgconfig. This is true for PC versions of OPENCV (because the x86 OPENCV has been installed before). But as long as the first line of the prefix path to the arm version of the OPENCV installation path (that is, the value of the Cmakeinstallprefix parameter above) can be used directly. opencv2.3.1 in the arm end of the transplant this post said Libs to add-lrt-lpthread parameters, my environment does not seem to need, but plus also no problem.

This configuration is good, ARM-LINUX-GCC compile with the parameter ' pkg-config--cflags--libs opencv-arm ' on the line, such as ARM-LINUX-GCC ' Pkg-config--cflags Opencv-arm ' Test.c-o test. In this case. pc file name is Opencv-arm, note two inverted quotes. I use QT primarily, so in the. Pro file, add:

    Unix {
        CONFIG + + link_pkgconfig
        pkgconfig + =/usr/local/lib/pkgconfig/opencv-arm.pc
    }

However, some warnings may appear after the compilation succeeds, such as:

    .. /.. /lib/libopencv_core.so, needed by/usr/local/opencv-arm/lib/libopencv_highgui.so, not found (try Using-rpath or- Rpath-link)

This warning, in my case, just put all the. so files in the opencv-arm/lib to/opt/friendlyarm/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/. Lib can be resolved, but the fact that no matter what the warning will not be a problem, will not affect the operation of the program. Last year, it was a transplant.

But it's not the problems that cost me four days. There is wood. I'm going to start puking. There's wood.

First of all to spit out the U disk, there is a previously compiled program on the U disk has been unable to run, the error

    .. /.. /lib/libopencv_core.so, needed by/usr/local/opencv-arm/lib/libopencv_highgui.so, not found (try Using-rpath or- Rpath-link)

As with that warning at compile time, I thought that the warning had to be solved. Then toss for a long time found that as long as the program to the board on the storage media can directly run. NI is a file system or permission of God horse problem ah. So I replaced it with an NFS mount.

Now compiled last year that program is able to run, but the newly compiled program can not be connected with the OpenCV library, but also reported the same fault, well, I tried to put the. so file under/lib, put under/usr/local/opencv-arm/lib, two, Even tried to create a good number of folders, placed under the/opt/friendlyarm/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/lib, the results are the same. Only the old program can run, not the new compiled. Later, the brain finally enlightened, since the old program can run, indicating that I transplanted the OPENCV library no problem. So I tried to compile a simple program directly with ARMM-LINUX-GCC and found that it was working properly. Then I don't know what to think. Copy the newly compiled program to the/MNT, which is the Directory of NFS Mount, something magical happens, it works ...

So, what exactly is this principle? I haven't figured it out yet. After NFS mounts, all mounted files are equivalent to the files in their original file system. It's still a matter of authority or something.

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.