0

My system is Ubuntu 14.04. I tried many several methods to install OpenCV (tried both 2 and 3). I can not successfully install.

I followed [this documentation][1] for the installation and got this error.

UPDATE:

I reinstalled ffmpeg and x264. I have tried almost all the blogposts and official docs. This is the error I find:

UPDATE 2:

Please find the new error again here

UPDATE 3:

I upgraded to Ubuntu 16.04 and tried to reinstall OpenCV but it did not help. Find the error here:

/usr/bin/ld: cannot find -lSDL2 collect2: error: ld returned 1 exit status modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:256: recipe for target 'lib/libopencv_videoio.so.3.1.0' failed make[2]: * [lib/libopencv_videoio.so.3.1.0] Error 1 CMakeFiles/Makefile2:6364: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed make[1]: * [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 Makefile:160: recipe for target 'all' failed make: *** [all] Error 2

Mat_python
  • 151
  • 2
  • 2
  • 10
  • Your picture actually shows only the number of errors but none of the error descriptions. – Quang Hoang Feb 23 '17 at 22:01
  • @QuangHoang Please find the new image. I have been trying to install since last two days. I have followed almost all blogposts and tutorials. – Mat_python Feb 23 '17 at 23:21
  • It says `libavcodec` is missing. Did you install it? – Quang Hoang Feb 23 '17 at 23:27
  • No. I did install ffmpeg. How can I install 'libavcodec'? I just find libavcodec-dev – Mat_python Feb 23 '17 at 23:50
  • try `sudo apt-get install libavcodec*` – Quang Hoang Feb 23 '17 at 23:51
  • Nope. Some error. Please find [here](http://imgur.com/a/RsP3O) – Mat_python Feb 23 '17 at 23:53
  • If I do without * then this is the error: sudo apt-get install libavcodec Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libavcodec – Mat_python Feb 23 '17 at 23:53
  • It looks like you already have `libavcodec` installed. You may want to symlink `libavcodec.so.54` to `/usr/local/lib`. – Quang Hoang Feb 23 '17 at 23:56
  • Okay. Is this correct? I tried this: `sudo ln -s /usr/local/lib libavcodec.so.54` – Mat_python Feb 24 '17 at 00:00
  • It's the other way around: `sudo ln -s /path/to/libavcodec.so /usr/local/lib/libavcodec.so.54`. You need to find the path to `libavcodec.so` or the similar though. – Quang Hoang Feb 24 '17 at 00:03
  • Okay. Done. Now, what would you recommend to install opencv again? Should I delete all the files and reinstall? Please refer me to the good installation link – Mat_python Feb 24 '17 at 00:06
  • It's a good guide already. Just try `cmake ..` and `make` again. If you have gui on your Ubuntu, I recommend using `cmake-gui` instead of `cmake` in terminal. – Quang Hoang Feb 24 '17 at 00:10
  • @QuangHoang Please find the error in update 2. – Mat_python Feb 24 '17 at 00:49
  • Please Follow this tutorial: http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/ – ZdaR Feb 24 '17 at 05:29
  • @ZdaR I did follow that. But, it is still not working. I also upgraded to Ubuntu 16.04 LTS just for OpenCV installation. – Mat_python Feb 28 '17 at 08:38

2 Answers2

0

There were some dependencies which did not allow the system to install. I followed almost all tutorials. I could easily install OpenCV2/3 with conda.

Mat_python
  • 151
  • 2
  • 2
  • 10
0

libavcodec-dev was discontinued since trusty (14.04), and FFmpeg replaced it. Having said that, building opencv from source still requires this and some other deprecated libraries. (You might need to search in other repositories, look only for official ones). I noticed this error when I followed the same method of building opencv from source on Linux Mint 19 and Ubuntu 18.04 Gnome. You might also want to re-clone/download the opencv repository from GitHub and git checkout 3.4.1 or higher.