OPENCV Linux Environment to build __linux

Source: Internet
Author: User


Note: This blog finally did not build a successful OpenCV in Linux, please go: http://blog.csdn.net/tanhngbo/article/details/40403885

To see a successful build.

In addition, here is the success in Windows built in the effect: http://blog.csdn.net/tanhngbo/article/details/40319805



Get OpenCV under Windows, this time in Linux (Ubuntu 10.04) to build a.


Untold hardships completely uninstall the residual VMware, and painstakingly loaded on the Vmware-tools

Then follow the official website of the tutorial to see:

Http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html


Install the software first:

[Compiler] sudo apt-get install build-essential
[Required] sudo-apt-get install cmake git libgtk2.0-dev pkg-config lib Avcodec-dev Libavformat-dev Libswscale-dev
[optional] sudo apt-get install Python-dev python-numpy libtbb2 Libtbb-dev libjpeg-dev Libpng-dev Libtiff-dev libjasper-dev Libdc1394-22-dev


The internet is too slow, it feels like a long time.


Git doesn't fit, and then it's changed to Git-core.


Next use

Cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local.

Found CMake version is too old, so download from the official website: http://www.cmake.org/download/

I am lazy, download the binary:cmake-3.0.2-linux-i386.tar.gz

And then the extracted copy into/usr inside


And then you can build it.

CMake Error at 3rdparty/ippicv/downloader.cmake:75 (message):
icv:failed to download ICV package:ippicv_linux_20140513.tgz.
status=6; " Couldn ' t resolve host name '


I can't afford to be here, there's a reply:

http://answers.opencv.org/question/40425/opencv-build-fails-because-i-cannot-download-icv/

Just slack off and shield it.


cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d With_ipp=off.

Next use:


Clam, finally see the compiling screen.





/home/tan/desktop/opencv-3.0.0-alpha/modules/core/src/ocl.cpp:in member function ' void Cv::ocl::image2d::impl:: init (const cv::umat&, BOOL, BOOL) ':
/home/tan/desktop/opencv-3.0.0-alpha/modules/core/src/ocl.cpp:4635:error: #pragma GCC diagnostic not allowed inside Functions
/home/tan/desktop/opencv-3.0.0-alpha/modules/core/src/ocl.cpp:4635:error: #pragma GCC diagnostic not allowed inside Functions
/home/tan/desktop/opencv-3.0.0-alpha/modules/core/src/ocl.cpp:4638:error: #pragma GCC diagnostic not allowed inside Functions
MAKE[2]: * * * [MODULES/CORE/CMAKEFILES/OPENCV_CORE.DIR/SRC/OCL.CPP.O] Error 1
MAKE[2]: * * * waiting for unfinished jobs ....
MAKE[1]: * * * [Modules/core/cmakefiles/opencv_core.dir/all] Error 2
Make: * * * [ALL] Error 2

It looks like GCC is too old.


Find a Mirror:

Http://mirrors-ru.go-parts.com/gcc/releases/gcc-4.9.1/

Download the latest GCC from inside.

There are scary 110MB, no matter, first down.




After downloading GCC, compile to find:

Configure:error:Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.

It's been a long time, so I'm going to change to a OPENCV version.


Also last officer Nets grabbed a OPECV 2.4.9 version, this should be better.

If it doesn't work out again, I'll get the old version.


Sure enough, this is a direct use.

Cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local.

You can compile it.

My current configuration is CMake update to 3.0.2,GCC no update, is 4.4.3 version


This is a problem again.

Error: ' Avformat_free_context ' is not declared into this scope

http://answers.opencv.org/question/32801/unresoved-avformat_free_context-was-not-declared/

This shows the reason why the ffmpeg version is too old. I found that my machine was not installed at all.


sudo apt-get install FFmpeg


It seems that there is something wrong with the net. The bridge is the problem, before using NAT to connect, had to use bridge.


Download ffmpeg-1.2.9.tar.gz and use


./configure--disable-yasm

Make-j4


sudo make install


The installation is ready.

Then compile opencv and fail again, a bunch of trace information, forget it, reinstall Ubuntu 12.04 try it.








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.